Skip to content

Commit

Permalink
Updating CodeIgniter for PHP 7.3 compatibility, issue 5482.
Browse files Browse the repository at this point in the history
Signed-off-by:Ivan Tcholakov <[email protected]>
  • Loading branch information
ivantcholakov committed Jan 8, 2019
1 parent 97e96aa commit 5e2af10
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 22 deletions.
2 changes: 1 addition & 1 deletion application/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"optimize-autoloader": true
},
"require": {
"codeigniter/framework": "dev-3.1-stable#c21c0359e1b4d96b1186ca2db78a01c7f38e904d",
"codeigniter/framework": "dev-3.1-stable#12ee9843877bf80159d1d89a0e3a4f170e902725",
"roave/security-advisories": "dev-master",
"paragonie/random_compat": "^2.0.2",
"guzzlehttp/guzzle": "~6.0",
Expand Down
16 changes: 8 additions & 8 deletions application/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function singular($str)
{
$result = strval($str);

if ( ! is_countable($result))
if ( ! word_is_countable($result))
{
return $result;
}
Expand Down Expand Up @@ -128,7 +128,7 @@ function plural($str)
{
$result = strval($str);

if ( ! is_countable($result))
if ( ! word_is_countable($result))
{
return $result;
}
Expand Down Expand Up @@ -226,15 +226,15 @@ function humanize($str, $separator = '_')

// --------------------------------------------------------------------

if ( ! function_exists('is_countable'))
if ( ! function_exists('word_is_countable'))
{
/**
* Checks if the given word has a plural version.
*
* @param string $word Word to check
* @return bool
*/
function is_countable($word)
function word_is_countable($word)
{
return ! in_array(
strtolower($word),
Expand Down Expand Up @@ -274,3 +274,14 @@ function is_countable($word)
);
}
}

// --------------------------------------------------------------------

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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ 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
:rtype: bool

Checks if the given word has a plural version. Example::

is_countable('equipment'); // Returns FALSE
word_is_countable('equipment'); // Returns FALSE

.. note:: This function used to be called ``is_countable()`` in
in previous CodeIgniter versions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()`.
14 changes: 7 additions & 7 deletions application/vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
"source": {
"type": "git",
"url": "https://github.com/bcit-ci/CodeIgniter.git",
"reference": "c21c0359e1b4d96b1186ca2db78a01c7f38e904d"
"reference": "12ee9843877bf80159d1d89a0e3a4f170e902725"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/c21c0359e1b4d96b1186ca2db78a01c7f38e904d",
"reference": "c21c0359e1b4d96b1186ca2db78a01c7f38e904d",
"url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/12ee9843877bf80159d1d89a0e3a4f170e902725",
"reference": "12ee9843877bf80159d1d89a0e3a4f170e902725",
"shasum": ""
},
"require": {
Expand Down Expand Up @@ -1060,12 +1060,12 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "5f3e0c82ada2d16fdd637b24e095888f4abac43f"
"reference": "7989c51d910c456aa07e8e149a98afac5de69e7a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/5f3e0c82ada2d16fdd637b24e095888f4abac43f",
"reference": "5f3e0c82ada2d16fdd637b24e095888f4abac43f",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/7989c51d910c456aa07e8e149a98afac5de69e7a",
"reference": "7989c51d910c456aa07e8e149a98afac5de69e7a",
"shasum": ""
},
"conflict": {
Expand Down Expand Up @@ -1242,7 +1242,7 @@
"zfcampus/zf-apigility-doctrine": ">=1,<1.0.3",
"zfr/zfr-oauth2-server-module": "<0.1.2"
},
"time": "2018-12-30T13:00:21+00:00",
"time": "2019-01-08T04:52:50+00:00",
"type": "metapackage",
"notification-url": "https://packagist.org/downloads/",
"license": [
Expand Down

0 comments on commit 5e2af10

Please sign in to comment.