Bug #69776 [Fbk->NoF]: mb_strlen() produces different results from previous PHP versions
| From: | php-bugs at lists dot php dot net | Date: | Sun, 21 Jun 2015 04:22:19 +0000 |
| Subject: | Bug #69776 [Fbk->NoF]: mb_strlen() produces different results from previous PHP versions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193730@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69776&edit=1
ID: 69776
Updated by: php-bugs@lists.php.net
Reported by: martijn at vanderlee dot com
Summary: mb_strlen() produces different results from previous
PHP versions
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: mbstring related
Operating System: Any
PHP Version: 5.6.9
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2015-06-08 20:14:45] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
The default character encoding changed with PHP 5.6. You were/are relying on its default being
(apparently) UTF-8 when that was not the case, thus the incorrect value of 31. Now the default is
UTF-8 and you're getting 17.
https://wiki.php.net/rfc/default_encoding
As to the bug you're reporting, when I use mb_ereg_search_* I get 17 characters.
http://3v4l.org/JWP3O
------------------------------------------------------------------------
[2015-06-08 19:47:05] martijn at vanderlee dot com
Description:
------------
mb_strlen() on PHP 5.6 sometimes returns different values than the exact same call on previous
versions of PHP (tested with 5.3, 5.4 and 5.5).
For the given test script, PHP 5.6 returns "17" whereas all other versions return
"31".
It seems 5.6 is correct, however, when using the mb_ereg_search_* functions, they still return match
lengths like PHP 5.5 and before. i.e. they total up to 31 for the entire string.
Regardless of which version is right, all multibyte functions should atleast produce consistent
results within the same version of PHP.
Test script:
---------------
echo mb_strlen('αÏÏ Ïο Îξιον ÎÏÏί');
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69776&edit=1