Skip to content

Commit

Permalink
Merge branch 'PHP-8.3' into PHP-8.4
Browse files Browse the repository at this point in the history
* PHP-8.3:
  Fix GH-17216: Trampoline crash on error
  • Loading branch information
nielsdos committed Dec 20, 2024
2 parents 32148e9 + 2c3b56d commit 6274327
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ PHP NEWS
promotion correctly). (nielsdos)
. Fixed bug GH-17200 (Incorrect dynamic prop offset in hooked prop iterator).
(ilutov)
. Fixed bug GH-17216 (Trampoline crash on error). (nielsdos)

- DBA:
. Skip test if inifile is disabled. (orlitzky)
Expand Down
22 changes: 22 additions & 0 deletions Zend/tests/named_params/gh17216.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
GH-17216 (Trampoline crash on error)
--FILE--
<?php
class TrampolineTest {
public function __call(string $name, array $arguments) {
var_dump($name, $arguments);
}
}
$o = new TrampolineTest();
$callback = [$o, 'trampoline'];
$array = ["a" => "b", 1];
try {
forward_static_call_array($callback, $array);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
echo "Done\n";
?>
--EXPECT--
Cannot use positional argument after named argument
Done
4 changes: 4 additions & 0 deletions Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,11 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
ZEND_CALL_NUM_ARGS(call) = i;
cleanup_args:
zend_vm_stack_free_args(call);
if (ZEND_CALL_INFO(call) & ZEND_CALL_HAS_EXTRA_NAMED_PARAMS) {
zend_free_extra_named_params(call->extra_named_params);
}
zend_vm_stack_free_call_frame(call);
zend_release_fcall_info_cache(fci_cache);
return SUCCESS;
}
}
Expand Down

0 comments on commit 6274327

Please sign in to comment.