Bug #68644 [NEW]: strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache
| From: | e dot furmanyuk at timeweb dot ru | Date: | Wed, 24 Dec 2014 07:59:33 +0000 |
| Subject: | Bug #68644 [NEW]: strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-189172@lists.php.net to get a copy of this message | ||
From: e dot furmanyuk at timeweb dot ru
Operating system: Ubuntu, Centos
PHP version: 5.6.4
Package: opcache
Bug Type: Bug
Bug description:strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache
Description:
------------
Greetings.
If set in php.ini
mbstring.func_overload=2
mbstring.internal_encoding="UTF-8"
or in .htaccess
php_value mbstring.func_overload 2
php_value mbstring.internal_encoding UTF-8
And set enable extension mbstring and opcache.
And after all run the script, the result will be the first
implementation of the correct result, but subsequent executions F5 will
give an incorrect result.
Strlen not overload by mb_strlen.
Other function such as substr and strtolower and etc work perfectly.
If you disable opcahe problem disappears.
Test script:
---------------
<?php
echo "strlen =
".strlen("\xd0\xa2\xd0\xa2\xd0\xa2\xd0\xa2\xd0\xa2\xd0\xa2")."\n<br>"
;
echo "mb_strlen = ".mb_strlen
("\xd0\xa2\xd0\xa2\xd0\xa2\xd0\xa2\xd0\xa2\xd0\xa2")."\n<br>";
?>
Expected result:
----------------
6
6
Actual result:
--------------
12
6
--
Edit bug report at https://bugs.php.net/bug.php?id=68644&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68644&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68644&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68644&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68644&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68644&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68644&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68644&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68644&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68644&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68644&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68644&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68644&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68644&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68644&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68644&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68644&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68644&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68644&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68644&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68644&r=mysqlcfg