summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2018-06-01 17:07:34 +0200
committerAndrey Andreev <narf@devilix.net>2019-01-08 16:46:10 +0100
commit12ee9843877bf80159d1d89a0e3a4f170e902725 (patch)
treea8a9dfb5ec1632bceb5fa4842f5f86cff751b4c9
parentc21c0359e1b4d96b1186ca2db78a01c7f38e904d (diff)
[ci skip] Close #5482
-rw-r--r--system/helpers/inflector_helper.php19
-rw-r--r--tests/codeigniter/helpers/inflector_helper_test.php2
-rw-r--r--user_guide_src/source/helpers/inflector_helper.rst7
-rw-r--r--user_guide_src/source/installation/upgrade_3110.rst11
4 files changed, 32 insertions, 7 deletions
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index bd36c3514..1c14f4a3e 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -63,7 +63,7 @@ if ( ! function_exists('singular'))
{
$result = strval($str);
- if ( ! is_countable($result))
+ if ( ! word_is_countable($result))
{
return $result;
}
@@ -128,7 +128,7 @@ if ( ! function_exists('plural'))
{
$result = strval($str);
- if ( ! is_countable($result))
+ if ( ! word_is_countable($result))
{
return $result;
}
@@ -226,7 +226,7 @@ if ( ! function_exists('humanize'))
// --------------------------------------------------------------------
-if ( ! function_exists('is_countable'))
+if ( ! function_exists('word_is_countable'))
{
/**
* Checks if the given word has a plural version.
@@ -234,7 +234,7 @@ if ( ! function_exists('is_countable'))
* @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'))
);
}
}
+
+// --------------------------------------------------------------------
+
+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 81ce5e394..3ec681bcd 100644
--- a/tests/codeigniter/helpers/inflector_helper_test.php
+++ b/tests/codeigniter/helpers/inflector_helper_test.php
@@ -93,4 +93,4 @@ class Inflector_helper_test extends CI_TestCase {
}
}
-} \ 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 df0c568c0..e3c014939 100644
--- a/user_guide_src/source/helpers/inflector_helper.rst
+++ b/user_guide_src/source/helpers/inflector_helper.rst
@@ -85,7 +85,7 @@ The following functions are available:
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 @@ The following functions are available:
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 a19f1e68e..0e3b7c676 100644
--- a/user_guide_src/source/installation/upgrade_3110.rst
+++ b/user_guide_src/source/installation/upgrade_3110.rst
@@ -12,3 +12,14 @@ Replace all files and directories in your *system/* directory.
.. 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()`.