Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix invalid returned opcode for memoized expressions
This commit is contained in:
Ilija Tovilo 2023-10-03 14:02:28 +02:00
commit 24d6dce668
No known key found for this signature in database
GPG Key ID: A4F5D403F118200A
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,8 @@
--TEST--
Invalid opcode returned from zend_compile_var_inner() for memoized expression
--FILE--
<?php
strlen("foo")[0] ??= 123;
?>
--EXPECTF--
Fatal error: Cannot use result of built-in function in write context in %s on line %d

View File

@ -10616,7 +10616,8 @@ static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t ty
case ZEND_AST_NULLSAFE_METHOD_CALL:
case ZEND_AST_STATIC_CALL:
zend_compile_memoized_expr(result, ast);
return &CG(active_op_array)->opcodes[CG(active_op_array)->last - 1];
/* This might not actually produce an opcode, e.g. for expressions evaluated at comptime. */
return NULL;
}
}