#28789 [Opn->Csd]: ReflectionProperty getValue() fails on public static members
| From: | helly@php.net | Date: | Tue, 15 Jun 2004 20:43:11 +0000 |
| Subject: | #28789 [Opn->Csd]: ReflectionProperty getValue() fails on public static members | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60969@lists.php.net to get a copy of this message | ||
ID: 28789
Updated by: helly@php.net
Reported By: irv at soundforsound dot co dot uk
-Status: Open
+Status: Closed
Bug Type: Zend Engine 2 problem
-Operating System: Linux
+Operating System: *
-PHP Version: 5CVS-2004-06-15 (dev)
+PHP Version: 5.0.0RC3
-Assigned To:
+Assigned To: helly
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Still we cannot use getValue() on implicit or dynamic properties.
(implicit properties require #26182 to be fixed
correctly first).
Previous Comments:
------------------------------------------------------------------------
[2004-06-15 12:23:59] irv at soundforsound dot co dot uk
Description:
------------
Unless I misunderstand the (scarce) documentation, using
ReflectionProperty's getValue() should work on all public properties
but should throw an exception on private or protected. I guess the
getValue() method just checks for the numerical value of public and not
public static (257 i think?).
Reproduce code:
---------------
class String
{
public static $fails = 5;
public $works = 5;
}
$prop1= new ReflectionProperty('String', 'works');
$prop2= new ReflectionProperty('String', 'fails');
$obj= new String();
//works
var_dump($prop1->getValue($obj));
//exception
var_dump($prop2->getValue($obj));
Expected result:
----------------
prints "int(5)"
Actual result:
--------------
Fatal error: Uncaught exception 'ReflectionException' with message
'Cannot access non-public member' in
/home/irv/public_html/pureswank/src/reftest.php:74 Stack trace: #0
{main}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28789&edit=1