note 105417 added to reflectionclass.getstaticpropertyvalue
| From: | Antares at osu1 dot php dot net | Date: | Tue, 16 Aug 2011 14:11:57 +0000 |
| Subject: | note 105417 added to reflectionclass.getstaticpropertyvalue | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182510@lists.php.net to get a copy of this message | ||
It seems this method has a security level different from the getStaticProperties method.
If you make two classes A and B looking like
class A{
protected static $static_var='foo';
public function getStatic(){
$class=new ReflectionClass($this);
return $class->getStaticPropertyValue('static_var');
}
public function getStatic2(){
$class=new ReflectionClass($this);
$staticProps=$class->getStaticProperties();
return $staticProps['static_var'];
}
public function __construct(){
echo $this->getStatic2();
echo $this->getStatic();
}
}
class B extends A{
protected static $static_var='foo2';
}
Then the output will be an exception for the getStatic() call, when the getStatic2() will correctly
return 'foo2';
----
Server IP: 69.147.83.197
Probable Submitter: 80.13.54.190
----
Manual Page -- http://www.php.net/manual/en/reflectionclass.getstaticpropertyvalue.php
Edit -- https://master.php.net/note/edit/105417
Del: integrated -- https://master.php.net/note/delete/105417/integrated
Del: useless -- https://master.php.net/note/delete/105417/useless
Del: bad code -- https://master.php.net/note/delete/105417/bad+code
Del: spam -- https://master.php.net/note/delete/105417/spam
Del: non-english -- https://master.php.net/note/delete/105417/non-english
Del: in docs -- https://master.php.net/note/delete/105417/in+docs
Del: other reasons-- https://master.php.net/note/delete/105417
Reject -- https://master.php.net/note/reject/105417
Search -- https://master.php.net/manage/user-notes.php