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
 [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: Sat Dec 21 12:01:31 2024 UTC