mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Merge branch 'PHP-7.4'
This commit is contained in:
commit
11d139625f
12
Zend/tests/assign_coalesce_006.phpt
Normal file
12
Zend/tests/assign_coalesce_006.phpt
Normal file
@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Null coalesce assign with memoized constant operand that is later interned (OSS-Fuzz #17903)
|
||||
--FILE--
|
||||
<?php
|
||||
$foo[__DIR__] ??= 42;
|
||||
var_dump($foo);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
["%s"]=>
|
||||
int(42)
|
||||
}
|
@ -2100,6 +2100,9 @@ static void zend_compile_memoized_expr(znode *result, zend_ast *expr) /* {{{ */
|
||||
} else if (result->op_type == IS_TMP_VAR) {
|
||||
zend_emit_op_tmp(&memoized_result, ZEND_COPY_TMP, result, NULL);
|
||||
} else {
|
||||
if (result->op_type == IS_CONST) {
|
||||
Z_TRY_ADDREF(result->u.constant);
|
||||
}
|
||||
memoized_result = *result;
|
||||
}
|
||||
|
||||
@ -7433,7 +7436,11 @@ void zend_compile_coalesce(znode *result, zend_ast *ast) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
static void znode_dtor(zval *zv) {
|
||||
efree(Z_PTR_P(zv));
|
||||
znode *node = Z_PTR_P(zv);
|
||||
if (node->op_type == IS_CONST) {
|
||||
zval_ptr_dtor_nogc(&node->u.constant);
|
||||
}
|
||||
efree(node);
|
||||
}
|
||||
|
||||
void zend_compile_assign_coalesce(znode *result, zend_ast *ast) /* {{{ */
|
||||
|
Loading…
Reference in New Issue
Block a user