Hi,

Lets say I have a class

class MyClass
  protected $foo = 'bar';
}

In PHP 5.1 I could do

$myobj = new MyClass();
$c = new ReflectionClass($myobj);
$p = $c->getProperty('foo');
echo $p->getValue($myobj); // bar

But in PHP 5.2 I now get an exception with "Cannot access non-public member 
MyClass::foo"

Yes, I do know that "protected" is supposed to make the variable internal 
(hence non-public), but shouldn't the ReflectionAPI enable one to "reverse 
engineer" all classes and properties - including the ones hidden in run-time? 
And if not, then how come it was like this in 5.1?

-fangel

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to