mbstring + func_overload=2 + UTF-8 + Opcache
| Bug #68644 | strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache | ||||
|---|---|---|---|---|---|
| Submitted: | 2014-12-24 07:59 UTC | Modified: | - | ||
| From: | e dot furmanyuk at timeweb dot ru | Assigned: | |||
| Status: | Closed | Package: | opcache | ||
| PHP Version: | 5.6.4 | OS: | Ubuntu, Centos | ||
| Private report: | No | CVE-ID: | None | ||
[2014-12-24 07:59 UTC] e dot furmanyuk at timeweb dot ru
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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2014-12-24 09:31 UTC] e dot furmanyuk at timeweb dot ru