You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT appears not to correctly account for property references in some cases #19831
Here, the right side of the assign operator may be IS_REFERENCE. Again, JIT does not account for this, so the left side gets assigned some extremely large number. I'm pretty sure these very large numbers are pointers to IS_REFERENCE due to the misinterpretation of the field. E.g. one of the strange numbers I saw was 140367337677697, which is a multiple of 8 plus 1, which tracks with the expected pointer alignment on x86_64. https://github.com/pmmp/PocketMine-MP/blob/636b96a9a5c35292f076e2f2e9c5723611d28d7b/src/block/SnowLayer.php#L89
It also appears that in some cases properties which are references are overwritten instead of updating the reference. I haven't been able to cleanly reproduce this.
As I said above, I don't currently have a reproducing test case for this. The bug has proven to be very elusive, and my efforts to recreate the issue in a local test case have thus far been unsuccessful. However, I believe I understand just enough of the PHP internals to make an educated guess what's going on.
JIT modes 1201 and 1202 did not reproduce the issue, but modes 1203, 1204 and 1205 do.
PHP Version
PHP 8.4.12 (cli) (built: Sep 13 2025 18:40:04) (ZTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.4.12, Copyright (c) Zend Technologies
with Zend OPcache v8.4.12, Copyright (c), by Zend Technologies
changed the title [-]JIT appears not to correctly account for possible references in math operations in some cases (no reproducing test case)[/-][+]JIT appears not to correctly account for property references in some cases[/+]on Sep 13, 2025
if (time() > 0) {
class Base {
}
}
class Test extends Base {
publicint$layers = 1;
publicfunctiongetLayers(): int {
return$this->layers;
}
}
$t = newTest();
$a = &$t->layers;
var_dump($t->getLayers());
Activity
dktapps commentedon Sep 13, 2025
Partial reproducing test case follows. Note that the
Testclass must be declared in a separate file, or this particular bug doesn't happen.main.phptest.phpOutputs something like:
but should output
[-]JIT appears not to correctly account for possible references in math operations in some cases (no reproducing test case)[/-][+]JIT appears not to correctly account for property references in some cases[/+]arnaud-lb commentedon Sep 15, 2025
Smaller reproducer:
Handle references after FETCH_OBJ_R with REG destination
arnaud-lb commentedon Sep 22, 2025
Thank you @dktapps!