Arquivos
hhvm/hphp/test/slow/reflection/setAccessibleTwo.php
T
Paul Tarjan 0335e335b7 build setAccessible
This implementation feels a bit haphazard with all the forces in the `o_*`. Is this stuff all changing dario?
2013-07-18 17:28:42 -07:00

20 linhas
430 B
PHP

<?php
error_reporting(E_ALL);
class A {
private $b = 'b';
}
class C {
static private $d = 'd';
}
$prop1 = (new ReflectionClass('A'))->getProperty('b');
$prop2 = (new ReflectionClass('A'))->getProperty('b');
$prop1->setAccessible(true);
$prop2->getValue(new A);
$prop1 = (new ReflectionClass('C'))->getProperty('d');
$prop2 = (new ReflectionClass('C'))->getProperty('d');
$prop1->setAccessible(true);
$prop2->getValue('C');