From:             alexiev at gmail dot com
Operating system: Linux
PHP version:      5.2.1
PHP Bug Type:     Class/Object related
Bug description:  Segfault when calling reflection methods of a dynamic property

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 bug report at http://bugs.php.net/?id=40460&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40460&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40460&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40460&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40460&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40460&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40460&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40460&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40460&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40460&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40460&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40460&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40460&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40460&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40460&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40460&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40460&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40460&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40460&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40460&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40460&r=mysqlcfg

Reply via email to