php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30146 ReflectionProperty->getValue() requires instance for static property
Submitted: 2004-09-19 00:26 UTC Modified: 2004-09-19 13:55 UTC
From: cellog@php.net Assigned: helly (profile)
Status: Closed Package: Class/Object related
PHP Version: 5.0.* OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cellog@php.net
New email:
PHP Version: OS:

 

 [2004-09-19 00:26 UTC] cellog@php.net
Description:
------------
When calling ReflectionProperty->getValue() on a public static property, getValue() requires an object instance to be passed in, even though this doesn't matter for static public properties.  It would be nice if null could be passed in addition to an instance.

Reproduce code:
---------------
<?php
class test {
  static public $a = 1;
}
$refl = new ReflectionProperty('test', 'a');
echo $refl->getValue(null);

Expected result:
----------------
1

Actual result:
--------------
Warning: getValue() expects parameter 1 to be object, null given in Command line code on line 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-19 13:55 UTC] helly@php.net
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.

Fixed in 5.1-dev, we probably MFH it after 5.0.2 is out.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 14 08:01:31 2024 UTC