xref: /PHP-8.2/Zend/tests/bug72177.phpt (revision 6e16e1da)
1--TEST--
2Bug #72177 Scope issue in __destruct after ReflectionProperty::setValue()
3--FILE--
4<?php
5class Child
6{
7    protected $bar;
8
9    public function __destruct()
10    {
11        $this->bar = null;
12    }
13}
14
15class Parnt
16{
17    protected $child;
18
19    public function doSomething()
20    {
21        $this->child = new Child();
22
23        $prop = new \ReflectionProperty($this, 'child');
24        $prop->setValue($this, null);
25    }
26}
27
28$p = new Parnt();
29$p->doSomething();
30
31echo "OK\n";
32?>
33--EXPECT--
34OK
35