mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Correctly handle extra named args for magic call in debug_backtrace_get_args()
This commit is contained in:
38
Zend/tests/function_arguments/gh20435_2.phpt
Normal file
38
Zend/tests/function_arguments/gh20435_2.phpt
Normal file
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
GH-20435: ZEND_CALL_HAS_EXTRA_NAMED_PARAMS & magic methods in debug_backtrace_get_args()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public static function __callStatic($name, $args) {
|
||||
echo (new Exception())->__toString(), "\n\n";
|
||||
}
|
||||
public function __call($name, $args) {
|
||||
echo (new Exception())->__toString(), "\n\n";
|
||||
}
|
||||
public function __invoke(...$args) {
|
||||
echo (new Exception())->__toString(), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C();
|
||||
$c->foo(bar: 'bar');
|
||||
C::foo(bar: 'bar');
|
||||
$c(bar: 'bar');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Exception in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): C->__call('foo', Array)
|
||||
#1 {main}
|
||||
|
||||
Exception in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): C::__callStatic('foo', Array)
|
||||
#1 {main}
|
||||
|
||||
Exception in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): C->__invoke(bar: 'bar')
|
||||
#1 {main}
|
||||
@@ -1795,12 +1795,14 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /
|
||||
ZVAL_EMPTY_ARRAY(arg_array);
|
||||
}
|
||||
|
||||
if (ZEND_CALL_INFO(call) & ZEND_CALL_HAS_EXTRA_NAMED_PARAMS) {
|
||||
if ((ZEND_CALL_INFO(call) & ZEND_CALL_HAS_EXTRA_NAMED_PARAMS)
|
||||
/* __call and __callStatic are non-variadic, potentially with
|
||||
* HAS_EXTRA_NAMED_PARAMS set. Don't add extra args, as they're already
|
||||
* contained in the 2nd param. */
|
||||
&& (call->func->common.fn_flags & ZEND_ACC_VARIADIC)) {
|
||||
zend_string *name;
|
||||
zval *arg;
|
||||
|
||||
ZEND_ASSERT(call->func->common.fn_flags & ZEND_ACC_VARIADIC);
|
||||
|
||||
zend_attribute *attribute = zend_get_parameter_attribute_str(
|
||||
call->func->common.attributes,
|
||||
"sensitiveparameter",
|
||||
|
||||
Reference in New Issue
Block a user