mirror of
https://github.com/php/php-src.git
synced 2024-12-12 03:15:29 +08:00
Fix bug #69832 (Assertion failure)
This commit is contained in:
parent
556423fcd0
commit
9db81340ba
26
Zend/tests/bug69832.phpt
Normal file
26
Zend/tests/bug69832.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #69832 (Assertion failed in zend_compile_const_expr_magic_const)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public $foo = [Bar::A, __CLASS__];
|
||||
}
|
||||
|
||||
eval(<<<'PHP'
|
||||
class Bar {
|
||||
const A = 1;
|
||||
}
|
||||
PHP
|
||||
);
|
||||
|
||||
var_dump((new Test)->foo);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
string(4) "Test"
|
||||
}
|
@ -5621,6 +5621,7 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
|
||||
{
|
||||
zend_ast_list *list = zend_ast_get_list(ast);
|
||||
uint32_t i;
|
||||
zend_bool is_constant = 1;
|
||||
|
||||
/* First ensure that *all* child nodes are constant and by-val */
|
||||
for (i = 0; i < list->children; ++i) {
|
||||
@ -5632,10 +5633,14 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
|
||||
if (by_ref || elem_ast->child[0]->kind != ZEND_AST_ZVAL
|
||||
|| (elem_ast->child[1] && elem_ast->child[1]->kind != ZEND_AST_ZVAL)
|
||||
) {
|
||||
return 0;
|
||||
is_constant = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_constant) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
array_init_size(result, list->children);
|
||||
for (i = 0; i < list->children; ++i) {
|
||||
zend_ast *elem_ast = list->child[i];
|
||||
|
Loading…
Reference in New Issue
Block a user