From: frzzman at yahoo dot com
Operating system: win32 - Windows Server 2003 Ent
PHP version: 5.0.0RC3
PHP Bug Type: Feature/Change Request
Bug description: get_class_methods() and get_class_vars() behaviour should be changed
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"
}
--
Edit bug report at http://bugs.php.net/?id=28787&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28787&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28787&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28787&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28787&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28787&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28787&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28787&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28787&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28787&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28787&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28787&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28787&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28787&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28787&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28787&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28787&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28787&r=float