php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40431 ReflectionProperty::isStatic() returns true for overloaded properties
Submitted: 2007-02-10 15:09 UTC Modified: 2007-02-10 20:52 UTC
From: bugs at forestfactory dot de Assigned: tony2001 (profile)
Status: Closed Package: Class/Object related
PHP Version: 4CVS-2007-02-10 (CVS) OS: Windows XP SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugs at forestfactory dot de
New email:
PHP Version: OS:

 

 [2007-02-10 15:09 UTC] bugs at forestfactory dot de
Description:
------------
For stdClass objects, ReflectionProperty::isStatic() returns true for all properties.

Code has two examples, the first one showing the bug, the second one showing the expected result.

Reproduce code:
---------------
<?php
// Creating Obj with "new" doesn't affect this bug
/* $Obj = new stdClass; */
$Obj->value = 'value';
$RefObj = new ReflectionObject($Obj);
foreach ($RefObj->getProperties() as $Property) {
  var_dump($Property->isStatic()); // prints "bool(true)"
}

// Reflection works for this class
class myClass extends stdClass {
}

$MyObj = new myClass;
$MyObj->value = 'value';
$RefObj = new ReflectionObject($MyObj);
foreach ($RefObj->getProperties() as $Property) {
  var_dump($Property->isStatic()); // prints "bool(false)"
}
?>

Expected result:
----------------
both var_dump's should print "bool(false)"

Actual result:
--------------
stdClass::$value is said to be static

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-10 20:52 UTC] tony2001@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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC