1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.2'

* PHP-8.2:
  Fix double-compilation of arrow-function
This commit is contained in:
Ilija Tovilo
2023-07-12 11:01:38 +02:00
3 changed files with 13 additions and 1 deletions

1
NEWS
View File

@@ -12,6 +12,7 @@ PHP NEWS
. Fixed bug GH-11601 (Incorrect handling of unwind and graceful exit
exceptions). (ilutov)
. Added zend_call_stack_get implementation for OpenBSD. (David Carlier)
. Fixed oss-fuzz #60411 (Fix double-compilation of arrow-functions). (ilutov)
- LDAP:
. Deprecate calling ldap_connect() with separate hostname and port.

View File

@@ -0,0 +1,11 @@
--TEST--
oss-fuzz #60441 (Double compilation of arrow function)
--FILE--
<?php
assert(fn()=>y)[y]??=y;
?>
--EXPECTF--
Fatal error: Uncaught Error: Undefined constant "y" in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d

View File

@@ -7613,7 +7613,7 @@ static void zend_compile_func_decl(znode *result, zend_ast *ast, bool toplevel)
zend_compile_closure_uses(uses_ast);
}
if (ast->kind == ZEND_AST_ARROW_FUNC) {
if (ast->kind == ZEND_AST_ARROW_FUNC && decl->child[2]->kind != ZEND_AST_RETURN) {
bool needs_return = true;
if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
zend_arg_info *return_info = CG(active_op_array)->arg_info - 1;