mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Add tests for GH-17151
This commit is contained in:
parent
f0441744db
commit
cbe9d67efc
3 changed files with 76 additions and 0 deletions
22
ext/opcache/tests/jit/gh17151_1.phpt
Normal file
22
ext/opcache/tests/jit/gh17151_1.phpt
Normal file
|
@ -0,0 +1,22 @@
|
|||
--TEST--
|
||||
GH-17151: ZEND_FETCH_OBJ_R may modify RC of op1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public function __get($name) {
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
$x = (new C)->bar;
|
||||
var_dump($x);
|
||||
}
|
||||
|
||||
test();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(C)#%d (0) {
|
||||
}
|
29
ext/opcache/tests/jit/gh17151_2.phpt
Normal file
29
ext/opcache/tests/jit/gh17151_2.phpt
Normal file
|
@ -0,0 +1,29 @@
|
|||
--TEST--
|
||||
GH-17151: ZEND_FETCH_OBJ_R may modify RC of op1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public static $prop;
|
||||
|
||||
public function __get($name) {
|
||||
C::$prop = null;
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
echo __METHOD__, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
C::$prop = new C();
|
||||
C::$prop->bar;
|
||||
}
|
||||
|
||||
test();
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
C::__destruct
|
||||
Done
|
25
ext/opcache/tests/jit/gh17151_3.phpt
Normal file
25
ext/opcache/tests/jit/gh17151_3.phpt
Normal file
|
@ -0,0 +1,25 @@
|
|||
--TEST--
|
||||
GH-17151: Method calls may modify RC of ZEND_INIT_METHOD_CALL op1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public static $prop;
|
||||
|
||||
public function storeThis() {
|
||||
self::$prop = $this;
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
$c = new C();
|
||||
$c->storeThis();
|
||||
$c = null;
|
||||
}
|
||||
|
||||
test();
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
Loading…
Add table
Add a link
Reference in a new issue