#40460 [Opn->Fbk]: Segfault when calling reflection methods of a dynamic property
| From: | tony2001@php.net | Date: | Tue, 13 Feb 2007 09:58:41 +0000 |
| Subject: | #40460 [Opn->Fbk]: Segfault when calling reflection methods of a dynamic property | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108792@lists.php.net to get a copy of this message | ||
ID: 40460
Updated by: tony2001@php.net
Reported By: alexiev at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 5.2.1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2007-02-13 09:54:34] alexiev at gmail dot com
Description:
------------
The dynamic properties are introduced in php 5.2 The problem I found
was when you try to call most of the methods of the ReflectionProperty
instance for a dynamic object property, returned with
ReflectionObject::getProperties.
Additionally when you use ReflectionObject:;getProperty($property_name)
for a dynamic property, an exception is thrown! The metter is duscussed
in #37682
Look at the code for more info.
I was able to test only on php 5.2.0! I don't know if the problem still
exists in php 5.2.1!
Reproduce code:
---------------
<?php
$i = new stdClass;
$i->dynamic_member = 'value';
$r = new ReflectionObject($i);
// $r->getProperty('dynamic_member'); throws an exception - there is no
'dynamic_member' property?
$properties = $r->getProperties();
var_dump($properties[0]); // Looks OK
var_dump($properties[0]->getName()); // Also OK
echo $properties[0]->isPublic() ? 'public' : 'notpublic'; // Causes
Segmentation fault
$properties[0]->isPrivate(); // Causes Segmentation fault
$properties[0]->isProtected(); // Causes Segmentation fault
$properties[0]->isStatic(); // Causes Segmentation fault
$properties[0]->isDefault(); // Causes Segmentation fault
$properties[0]->isPrivate(); // Causes Segmentation fault
?>
Expected result:
----------------
object(ReflectionProperty)#3 (2) {
["name"]=>
string(14) "dynamic_member"
["class"]=>
string(8) "stdClass"
}
string(14) "dynamic_member"
public
Actual result:
--------------
object(ReflectionProperty)#3 (2) {
["name"]=>
string(14) "dynamic_member"
["class"]=>
string(8) "stdClass"
}
string(14) "dynamic_member"
Segmentation fault
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40460&edit=1