Bug #68644 [Com]: strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache

From: Date: Wed, 24 Dec 2014 09:31:29 +0000
Subject: Bug #68644 [Com]: strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189175@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68644&edit=1 ID: 68644 Comment by: e dot furmanyuk at timeweb dot ru Reported by: e dot furmanyuk at timeweb dot ru Summary: strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache Status: Open Type: Bug Package: opcache Operating System: Ubuntu, Centos PHP Version: 5.6.4 Block user comment: N Private report: N New Comment: this part: or in .htaccess php_value mbstring.func_overload 2 php_value mbstring.internal_encoding UTF-8 is mistake. we are talking only about the php.ini. Previous Comments: ------------------------------------------------------------------------ [2014-12-24 07:59:31] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68644&edit=1

« previous php.bugs (#189175) next »