Skip to content

Fix GH-17747: Exception on reading property in register-based FETCH_OBJ_R breaks JIT #17749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -14539,7 +14539,11 @@ static int zend_jit_fetch_obj(zend_jit_ctx *jit,
}

if (may_throw) {
zend_jit_check_exception(jit);
if (Z_MODE(res_addr) == IS_REG) {
zend_jit_check_exception_undef_result(jit, opline);
} else {
zend_jit_check_exception(jit);
}
}

return 1;
Expand Down
23 changes: 23 additions & 0 deletions ext/opcache/tests/jit/gh17747.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
GH-17747 (Exception on reading property in register-based FETCH_OBJ_R breaks JIT)
--EXTENSIONS--
opcache
--INI--
opcache.jit=function
--FILE--
<?php
class C {
public int $a;
public function test() {
var_dump($this->a);
}
}
$test = new C;
$test->test();
?>
--EXPECTF--
Fatal error: Uncaught Error: Typed property C::$a must not be accessed before initialization in %s:%d
Stack trace:
#0 %s(%d): C->test()
#1 {main}
thrown in %s on line %d
Loading