mirror of
https://github.com/php/php-src.git
synced 2024-12-15 12:54:57 +08:00
6e16e1daa9
With this patch, it is no longer required to call `ReflectionProperty#setAccessible()` or `ReflectionMethod#setAccessible()` with `true`. If a userland consumer already got to the point of accessing object/class information via reflection, it makes little sense for `ext/reflection` to disallow accessing `private`/`protected` symbols by default. After this patch, calling `ReflectionProperty#setAccessible(true)` or `ReflectionMethod#setAccessible(true)` on newly instantiated `ReflectionProperty` or `ReflectionMethod` respectively will have no effect. RFC: https://wiki.php.net/rfc/make-reflection-setaccessible-no-op Closes GH-5412.
34 lines
513 B
PHP
34 lines
513 B
PHP
--TEST--
|
|
Bug #72177 Scope issue in __destruct after ReflectionProperty::setValue()
|
|
--FILE--
|
|
<?php
|
|
class Foo
|
|
{
|
|
private $bar = 'bar';
|
|
|
|
public function __construct()
|
|
{
|
|
unset($this->bar);
|
|
}
|
|
}
|
|
|
|
class Bar extends Foo
|
|
{
|
|
private $baz = 'baz';
|
|
private static $tab = 'tab';
|
|
|
|
public function __get(string $name)
|
|
{
|
|
var_dump($this->baz);
|
|
var_dump(self::$tab);
|
|
return $name;
|
|
}
|
|
}
|
|
|
|
$r = new ReflectionProperty(Foo::class, 'bar');
|
|
|
|
echo "OK\n";
|
|
?>
|
|
--EXPECT--
|
|
OK
|