mirror of
https://github.com/php/php-src.git
synced 2024-12-16 21:37:49 +08:00
- Fixed bug #47572 (zval_update_constant_ex: Segmentation fault)
This commit is contained in:
parent
d81acb4403
commit
fadd129268
17
Zend/tests/bug47572.phpt
Normal file
17
Zend/tests/bug47572.phpt
Normal file
@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #47572 (zval_update_constant_ex: Segmentation fault)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
public static $bar = array(
|
||||
FOO => "bar"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$foo = new Foo();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Use of undefined constant FOO - assumed 'FOO' in %s on line %d
|
@ -655,10 +655,12 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
|
||||
str_index.u = colon.u + 1;
|
||||
} else {
|
||||
if (str_index.u[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) {
|
||||
actual = (UChar *)u_memrchr(str_index.u, '\\', str_index_len - 3) + 1;
|
||||
if ((actual = (UChar *)u_memrchr(str_index.u, '\\', str_index_len - 3))) {
|
||||
actual++;
|
||||
str_index_len -= (actual - str_index.u);
|
||||
str_index.u = actual;
|
||||
}
|
||||
}
|
||||
if (str_index.u[0] == '\\') {
|
||||
++str_index.u;
|
||||
--str_index_len;
|
||||
@ -678,10 +680,12 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
|
||||
str_index.s = colon.s + 1;
|
||||
} else {
|
||||
if (str_index.s[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) {
|
||||
actual = (char *)zend_memrchr(str_index.s, '\\', str_index_len - 3) + 1;
|
||||
if ((actual = (char *)zend_memrchr(str_index.s, '\\', str_index_len - 3))) {
|
||||
actual++;
|
||||
str_index_len -= (actual - str_index.s);
|
||||
str_index.s = actual;
|
||||
}
|
||||
}
|
||||
if (str_index.s[0] == '\\') {
|
||||
++str_index.s;
|
||||
--str_index_len;
|
||||
|
Loading…
Reference in New Issue
Block a user