mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix failed assertion for assignment in expression context
This code path is reachable for all assignments expressions, not just true variable expressions. Really surprising we have no tests that caught this.
This commit is contained in:
20
Zend/tests/gh20628_005.phpt
Normal file
20
Zend/tests/gh20628_005.phpt
Normal file
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Failed assertion for assignment in expression context
|
||||
--CREDITS--
|
||||
Matteo Beccati (mbeccati)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function foo() {
|
||||
return ['bar' => 'baz'];
|
||||
}
|
||||
|
||||
var_dump(($v = foo())['bar'], $v);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "baz"
|
||||
array(1) {
|
||||
["bar"]=>
|
||||
string(3) "baz"
|
||||
}
|
||||
@@ -12303,7 +12303,6 @@ static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t ty
|
||||
zend_compile_assign_ref(result, ast, type);
|
||||
return NULL;
|
||||
case ZEND_AST_ASSIGN:
|
||||
ZEND_ASSERT(ast->child[0]->kind == ZEND_AST_ARRAY && zend_propagate_list_refs(ast->child[0]));
|
||||
zend_compile_assign(result, ast, false, type);
|
||||
return NULL;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user