2 Test ReflectionProperty::setValue() error cases.
9 static public $stat = "static property";
11 private $priv = "keepOut";
17 $instance = new TestClass();
18 $instanceWithNoProperties = new AnotherClass();
19 $propInfo = new ReflectionProperty('TestClass', 'pub2');
21 echo "\nProtected property:\n";
23 $propInfo = new ReflectionProperty('TestClass', 'prot');
24 var_dump($propInfo->setValue($instance, "NewValue"));
26 catch(Exception $exc) {
27 echo $exc->getMessage();
30 echo "\n\nInstance without property:\n";
31 $propInfo = new ReflectionProperty('TestClass', 'pub2');
32 var_dump($propInfo->setValue($instanceWithNoProperties, "NewValue"));
33 var_dump($instanceWithNoProperties->pub2);
37 Cannot access non-public member TestClass::$prot
39 Instance without property: