|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-06-15 09:25 UTC] frzzman at yahoo dot com
[2004-06-15 21:37 UTC] helly@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 02:00:02 2025 UTC |
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" }