Skip to content

Commit 6274327

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-17216: Trampoline crash on error
2 parents 32148e9 + 2c3b56d commit 6274327

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ PHP NEWS
2121
promotion correctly). (nielsdos)
2222
. Fixed bug GH-17200 (Incorrect dynamic prop offset in hooked prop iterator).
2323
(ilutov)
24+
. Fixed bug GH-17216 (Trampoline crash on error). (nielsdos)
2425

2526
- DBA:
2627
. Skip test if inifile is disabled. (orlitzky)

Zend/tests/named_params/gh17216.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
GH-17216 (Trampoline crash on error)
3+
--FILE--
4+
<?php
5+
class TrampolineTest {
6+
public function __call(string $name, array $arguments) {
7+
var_dump($name, $arguments);
8+
}
9+
}
10+
$o = new TrampolineTest();
11+
$callback = [$o, 'trampoline'];
12+
$array = ["a" => "b", 1];
13+
try {
14+
forward_static_call_array($callback, $array);
15+
} catch (Error $e) {
16+
echo $e->getMessage(), "\n";
17+
}
18+
echo "Done\n";
19+
?>
20+
--EXPECT--
21+
Cannot use positional argument after named argument
22+
Done

Zend/zend_execute_API.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,11 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
881881
ZEND_CALL_NUM_ARGS(call) = i;
882882
cleanup_args:
883883
zend_vm_stack_free_args(call);
884+
if (ZEND_CALL_INFO(call) & ZEND_CALL_HAS_EXTRA_NAMED_PARAMS) {
885+
zend_free_extra_named_params(call->extra_named_params);
886+
}
884887
zend_vm_stack_free_call_frame(call);
888+
zend_release_fcall_info_cache(fci_cache);
885889
return SUCCESS;
886890
}
887891
}

0 commit comments

Comments
 (0)