Behaviour of get_class_methods() and get_class_vars()

From: Date: Tue, 15 Jun 2004 05:34:51 +0000
Subject: Behaviour of get_class_methods() and get_class_vars()
Groups: php.general 
Request: Send a blank email to php-general+get-188294@lists.php.net to get a copy of this message
This copy directly from my bug report, someone here do you know any way around for this problem. ------------------------------------------ Description: ------------ When get_class_vars() return every properties of the class, private and protected members are mark with [Class Name] and * before its name, well it better being mark with + or - or # (like UML standard). Also, this function shouldn't return value of the property as private and protected can only be expose in the scope that have access permission. Next, get_class_methods() also return every methods the class have, without any marking method?!?! What's the point doing that if I can't figure out if I can access the class's method or not. I suggest these two function should return all attributes and methods with its access marking. And another function, maybe get_class_vars_value() to expose default value of attributes in the class, this function should return value of accessible attribute, too. Reproduce code: --------------- <?php class ClassA {
    private $PrivateVar = null;
    protected $ProtectedVar = null;
    public $PublicVar = null;
    private function PrivateFunc()
    {}
    protected function ProtectedFunc()
    {}
    public function PublicFunc()
    {}
} var_dump(get_class_vars('ClassA')); var_dump(get_class_methods('ClassA')); ?> Expected result: ---------------- array(3) { ["PrivateVar"] => string(1) - [" * ProtectedVar"] => string(1) # ["PublicVar"] => string(1) + } array(3) { ["PrivateFunc"] => string(1) - ["ProtectedFunc"] => string(1) # ["PublicFunc"] => string(1) + } Actual result: -------------- array(3) { [" ClassA PrivateVar"] => NULL [" * ProtectedVar"] => NULL ["PublicVar"] => NULL } array(3) { [0]=> string(11) "PrivateFunc" [1]=> string(13) "ProtectedFunc" [2]=> string(10) "PublicFunc" } ------------------------------------------

« previous php.general (#188294) next »