1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 10:16:41 +02:00
Files
archived-php-src/ext/opcache/tests/jit/assign_obj_on_null.phpt
T
Nikita Popov 97b5eeeb6c Fix leak with ASSIGN_OBJ on null
We still need to free op1 in this case.

Fixes oss-fuzz 5782176231194624 (part of #38542).
2021-09-28 16:33:11 +02:00

38 lines
649 B
PHP

--TEST--
ASSIGN_OBJ on null reference returned from __get()
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
class Test {
public $prop;
public function &__get($name) {
return $this->prop;
}
}
function test() {
$obj = new Test;
$obj->x->y = 1;
}
function test2() {
$obj = new Test;
$obj->x->y += 1;
}
try {
test();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
test2();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Attempt to assign property "y" on null
Attempt to assign property "y" on null