diff options
author | Andrey Andreev <narf@devilix.net> | 2017-03-24 10:04:53 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2017-03-24 10:04:53 +0100 |
commit | c7c0bdf4f7af7c4e71b073ee87ddb792087bdfac (patch) | |
tree | 5cfb825e1e0d67f30d4c8a91428cd52eb580695a /system/helpers/text_helper.php | |
parent | 1d9aaee34ea77fdb68d79d7add37f26dd2649c00 (diff) | |
parent | 0eb38af2eaf1127b9b82261b7ec3bf4d4b847318 (diff) |
Merge branch '3.1-stable' into develop
Conflicts resolved:
system/core/CodeIgniter.php
system/core/Common.php
system/core/Input.php
system/helpers/cookie_helper.php
tests/codeigniter/helpers/html_helper_test.php
user_guide_src/source/changelog.rst
user_guide_src/source/conf.py
user_guide_src/source/installation/downloads.rst
user_guide_src/source/installation/upgrading.rst
user_guide_src/source/libraries/input.rst
Diffstat (limited to 'system/helpers/text_helper.php')
-rw-r--r-- | system/helpers/text_helper.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 07c01c3af..217729b70 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -138,7 +138,10 @@ if ( ! function_exists('ascii_to_entities')) function ascii_to_entities($str) { $out = ''; - for ($i = 0, $s = strlen($str) - 1, $count = 1, $temp = array(); $i <= $s; $i++) + $length = defined('MB_OVERLOAD_STRING') + ? mb_strlen($str, '8bit') - 1 + : strlen($str) - 1; + for ($i = 0, $count = 1, $temp = array(); $i <= $length; $i++) { $ordinal = ord($str[$i]); @@ -176,7 +179,7 @@ if ( ! function_exists('ascii_to_entities')) $temp = array(); } // If this is the last iteration, just output whatever we have - elseif ($i === $s) + elseif ($i === $length) { $out .= '&#'.implode(';', $temp).';'; } |