mirror of
https://github.com/php/php-src.git
synced 2026-04-26 01:18:19 +02:00
Fixed bug #68644 (strlen incorrect : mbstring + func_overload=2 +UTF-8 + Opcache)
This commit is contained in:
@@ -38,6 +38,8 @@ PHP NEWS
|
||||
(Ashesh Vashi)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #68644 (strlen incorrect : mbstring + func_overload=2 +UTF-8
|
||||
+ Opcache). (Laruence)
|
||||
. Fixed bug #67111 (Memory leak when using "continue 2" inside two foreach
|
||||
loops). (Nikita)
|
||||
|
||||
|
||||
@@ -450,9 +450,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
|
||||
MAKE_NOP(opline);
|
||||
}
|
||||
}
|
||||
} else if (Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("strlen")-1 &&
|
||||
!memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)),
|
||||
"strlen", sizeof("strlen")-1)) {
|
||||
} else if ((!zend_hash_exists(&module_registry, "mbstring", sizeof("mbstring")) ||
|
||||
zend_ini_long("mbstring.func_overload",
|
||||
sizeof("mbstring.func_overload"), 0) < 2 /* MB_OVERLOAD_STRING */) &&
|
||||
Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("strlen") - 1 &&
|
||||
!memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "strlen", sizeof("strlen") - 1)) {
|
||||
zval t;
|
||||
|
||||
ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline - 1)));
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #68644 strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
mbstring.func_overload=2
|
||||
mbstring.internal_encoding=UTF-8
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('Zend OPcache') || !extension_loaded("mbstring")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(strlen("中国, 北京"));
|
||||
var_dump(mb_strlen("中国, 北京"));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(6)
|
||||
int(6)
|
||||
Reference in New Issue
Block a user