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

Merge branch 'PHP-8.4'

* PHP-8.4:
  Fix GH-16908: _ZendTestMagicCallForward does not handle references well
This commit is contained in:
Niels Dossche
2024-11-25 19:39:06 +01:00
2 changed files with 25 additions and 2 deletions

View File

@@ -1108,9 +1108,12 @@ static ZEND_METHOD(_ZendTestMagicCallForward, __call)
ZEND_IGNORE_VALUE(arguments);
zval func;
zval func, rv;
ZVAL_STR(&func, name);
call_user_function(NULL, NULL, &func, return_value, 0, NULL);
call_user_function(NULL, NULL, &func, &rv, 0, NULL);
ZVAL_COPY_DEREF(return_value, &rv);
zval_ptr_dtor(&rv);
}
PHP_INI_BEGIN()

View File

@@ -0,0 +1,20 @@
--TEST--
GH-16908 (_ZendTestMagicCallForward does not handle references well)
--EXTENSIONS--
zend_test
--FILE--
<?php
$cls = new _ZendTestMagicCallForward();
function &foo() {
}
$cls->foo()->x ??= 42;
?>
--EXPECTF--
Notice: Only variable references should be returned by reference in %s on line %d
Notice: Only variable references should be returned by reference in %s on line %d
Fatal error: Uncaught Error: Attempt to assign property "x" on null in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d