[ci skip] Close #5482
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index bd36c35..1c14f4a 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -63,7 +63,7 @@
{
$result = strval($str);
- if ( ! is_countable($result))
+ if ( ! word_is_countable($result))
{
return $result;
}
@@ -128,7 +128,7 @@
{
$result = strval($str);
- if ( ! is_countable($result))
+ if ( ! word_is_countable($result))
{
return $result;
}
@@ -226,7 +226,7 @@
// --------------------------------------------------------------------
-if ( ! function_exists('is_countable'))
+if ( ! function_exists('word_is_countable'))
{
/**
* Checks if the given word has a plural version.
@@ -234,7 +234,7 @@
* @param string $word Word to check
* @return bool
*/
- function is_countable($word)
+ function word_is_countable($word)
{
return ! in_array(
strtolower($word),
@@ -274,3 +274,14 @@
);
}
}
+
+// --------------------------------------------------------------------
+
+if ( ! function_exists('is_countable'))
+{
+ function is_countable($word)
+ {
+ trigger_error('is_countable() is a native PHP function since version 7.3.0; use word_is_countable() instead', E_USER_WARNING);
+ return word_is_countable($word);
+ }
+}
diff --git a/tests/codeigniter/helpers/inflector_helper_test.php b/tests/codeigniter/helpers/inflector_helper_test.php
index 81ce5e3..3ec681b 100644
--- a/tests/codeigniter/helpers/inflector_helper_test.php
+++ b/tests/codeigniter/helpers/inflector_helper_test.php
@@ -93,4 +93,4 @@
}
}
-}
\ No newline at end of file
+}
diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst
index df0c568..e3c0149 100644
--- a/user_guide_src/source/helpers/inflector_helper.rst
+++ b/user_guide_src/source/helpers/inflector_helper.rst
@@ -85,7 +85,7 @@
echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot'
-.. php:function:: is_countable($word)
+.. php:function:: word_is_countable($word)
:param string $word: Input string
:returns: TRUE if the word is countable or FALSE if not
@@ -93,4 +93,7 @@
Checks if the given word has a plural version. Example::
- is_countable('equipment'); // Returns FALSE
\ No newline at end of file
+ word_is_countable('equipment'); // Returns FALSE
+
+ .. note:: This function used to be called ``is_countable()`` in
+ in previous CodeIgniter versions.
diff --git a/user_guide_src/source/installation/upgrade_3110.rst b/user_guide_src/source/installation/upgrade_3110.rst
index a19f1e6..0e3b7c6 100644
--- a/user_guide_src/source/installation/upgrade_3110.rst
+++ b/user_guide_src/source/installation/upgrade_3110.rst
@@ -12,3 +12,14 @@
.. note:: If you have any custom developed files in these directories,
please make copies of them first.
+
+Step 2: Check for calls to is_countable()
+==========================================
+
+
+PHP 7.3 introduces a native `is_countable() <https://secure.php.net/is_countable>`_
+function, which creates a name collision with the ``is_countable()`` function
+we've had in our :doc:`Inflector Helpers <../helpers/inflector_helper>`.
+
+If you've been using the helper function in question, you should now rename
+the calls to it to :php:func:`word_is_countable()`.