xref: /PHP-8.0/Zend/tests/bug72177.phpt (revision e9c3f9fc)
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->setAccessible(true);
25        $prop->setValue($this, null);
26    }
27}
28
29$p = new Parnt();
30$p->doSomething();
31
32echo "OK\n";
33?>
34--EXPECT--
35OK
36