Skip to content

Fix GH-25449: Keep by-ref containers out of converted FUNC_ARG fetches - #25458

Open
iliaal wants to merge 1 commit into
php:PHP-8.6from
iliaal:fix/gh-25449-func-arg-ref-call
Open

iliaal wants to merge 1 commit into
php:PHP-8.6from
iliaal:fix/gh-25449-func-arg-ref-call

Conversation

@iliaal

@iliaal iliaal commented Nov 14, 2026

Copy link
Copy Markdown
Member

When g() returns by reference and the callee of f(g()['k']) is not known at compile time, OPcache passes null to f() and debug builds assert in FETCH_DIM_R. Since GH-20628, FETCH_DIM_R and FETCH_OBJ_R expect a VAR container to be unwrapped already, but pass 4 converts the FUNC_ARG fetch to its _R form while the container is still the VAR result of the by-ref call; an assignment by reference such as f(($y = &$x)['k']) hits the same assertion. Retype the call result to TMP, as the compiler emits for a known callee, and keep the FUNC_ARG fetch for any other producer except an already converted read fetch.

Fixes #25449

…ches

Since phpGH-20628, FETCH_DIM_R and FETCH_OBJ_R expect a VAR container to be
unwrapped already. Pass 4 turned FETCH_DIM_FUNC_ARG and FETCH_OBJ_FUNC_ARG
into their _R forms once the argument was known to be by-value, without
checking where the VAR came from, so a reference returned by a by-reference
call or produced by an assignment by reference reached the _R handler.
Retype a defining DO_*CALL result and the fetch operand to TMP, so the callee
unwraps its return value as it does when the callee is known at compile time.
Keep the FUNC_ARG fetch for any other producer that is not an already
converted read fetch.

Fixes phpGH-25449
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.

1 participant