Skip to content

Fix GH-24154: Function JIT ++/-- on typed property holding a reference - #24155

Merged
ndossche merged 1 commit into
php:masterfrom
lazerg:fix/gh-24154
Oct 6, 2026
Merged

ndossche merged 1 commit into
php:masterfrom
lazerg:fix/gh-24154

Conversation

@lazerg

@lazerg lazerg commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Since 1b2bde4, zend_jit_inc_typed_prop() and zend_jit_dec_typed_prop() only deref the copy, so var_ptr still points at the reference. The type check then fails on the reference itself, and the error path destroys it and overwrites the property slot. This puts the ZVAL_DEREF(var_ptr) back. The regression is only on master.

Fixes GH-24154

@ndossche ndossche 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.

indeed, the optimized macro must only be used when the original zval pointer isn't used
cc @TimWolla

@ndossche
ndossche merged commit 32f9db9 into php:master Oct 6, 2026
17 of 18 checks passed
@Girgias

Girgias commented Oct 6, 2026

Copy link
Copy Markdown
Member

There should be an explanation or comment somewhere (possibly on the declaration of ZVAL_COPY_DEREF) that the optimized macro cannot be used sometimes. As this is extremely unintuitive.

@TimWolla

TimWolla commented Oct 6, 2026

Copy link
Copy Markdown
Member

indeed, the optimized macro must only be used when the original zval pointer isn't used

If it isn't tested it doesn't exist. So worth it for the new test 😄

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.

Function JIT: ++/-- on a typed property holding a reference throws TypeError

4 participants