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 mis-compilation of by-reference nullsafe operator
This commit is contained in:
Ilija Tovilo
2023-06-28 20:37:25 +02:00
4 changed files with 21 additions and 0 deletions

2
NEWS
View File

@@ -5,6 +5,8 @@ PHP NEWS
- Core:
. Fixed bug GH-11507 (String concatenation performance regression in 8.3).
(nielsdos)
. Fixed oss-fuzz #60011 (Mis-compilation of by-reference nullsafe operator).
(ilutov)
- DOM:
. Fixed bug GH-11500 (Namespace reuse in createElementNS() generates wrong

View File

@@ -0,0 +1,8 @@
--TEST--
oss-fuzz #60011 (Incorrect order of instruction with nullsafe operator)
--FILE--
<?php
[&$y]=$y->y?->y;
?>
--EXPECTF--
Fatal error: Cannot take reference of a nullsafe chain in %s on line %d

View File

@@ -0,0 +1,8 @@
--TEST--
oss-fuzz #60011 (Incorrect order of instruction with nullsafe operator)
--FILE--
<?php
[&$y]=$y?->y->y;
?>
--EXPECTF--
Fatal error: Cannot take reference of a nullsafe chain in %s on line %d

View File

@@ -3372,6 +3372,9 @@ static void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
if (!zend_is_variable_or_call(expr_ast)) {
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot assign reference to non referenceable value");
} else if (zend_ast_is_short_circuited(expr_ast)) {
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot take reference of a nullsafe chain");
}
zend_compile_var(&expr_node, expr_ast, BP_VAR_W, 1);