Skip to content

Fix GH-11406: segfault with unpacking and magic method closure - #11417

Closed
ndossche wants to merge 1 commit into
php:masterfrom
ndossche:fix-11406
Closed

ndossche wants to merge 1 commit into
php:masterfrom
ndossche:fix-11406

Conversation

@ndossche

@ndossche ndossche commented Jun 9, 2023

Copy link
Copy Markdown
Member

The magic method trampoline closure may be variadic. However, the arg_info for the variadic argument was not set, resulting in a crash both in reflection and in the VM.

Fix it by creating an arg_info containing a single element in case of the variadic case. The variadic argument is the last one (and in this case only one) in the arg_info array.

We make sure the argument info is equivalent to the argument info of $closure of the following code snippet:

function foo(...$arguments) {}
$closure = foo(...);

The magic method trampoline closure may be variadic. However, the
arg_info for the variadic argument was not set, resulting in a crash
both in reflection and in the VM.

Fix it by creating an arg_info containing a single element in case of
the variadic case. The variadic argument is the last one (and in this
case only one) in the arg_info array.

We make sure the argument info is equivalent to the argument info of
`$closure` of the following code snippet:
```
function foo(...$arguments) {}
$closure = foo(...);
```
@ndossche ndossche linked an issue Jun 9, 2023 that may be closed by this pull request

@dstogov dstogov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look Fine

@ndossche ndossche closed this in 5c78980 Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segfault on PHP 8.3

3 participants