mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
When read_property fails, it may return `&EG(uninitialized_zval)`, and the exception is handled in the VM. The VM will try to `zval_ptr_dtor_nogc` the result, but the result was never set, resulting in dtor'ing garbage data. To solve this, we check when a different zval* was returned and initialize the result with UNDEF. We don't need to copy as the slow_ex handler return values are used directly in a register. Closes GH-17749.
24 lines
469 B
PHP
24 lines
469 B
PHP
--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
|