ID:               40460
 Updated by:       [EMAIL PROTECTED]
 Reported By:      alexiev at gmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Class/Object related
 Operating System: Linux
 PHP Version:      5.2.0
 New Comment:

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.

Duplicate of bug #40431.


Previous Comments:
------------------------------------------------------------------------

[2007-02-13 10:32:14] alexiev at gmail dot com

Here are the test results:

Windows XP PHP 5.2.0
-----
object(ReflectionProperty)#3 (2) {
  ["name"]=>
  string(14) "dynamic_member"
  ["class"]=>
  string(8) "stdClass"
}
string(14) "dynamic_member"
notpublic

Windows XP PHP 5.2.2-dev (cli) (built: Feb 13 2007 08:23:31)
-----
object(ReflectionProperty)#3 (2) {
  ["name"]=>
  string(14) "dynamic_member"
  ["class"]=>
  string(8) "stdClass"
}
string(14) "dynamic_member"
public

Linux PHP 5.2.2-dev (cli) (built: Feb 13 2007 12:14:28)
-----
object(ReflectionProperty)#3 (2) {
  ["name"]=>
  string(14) "dynamic_member"
  ["class"]=>
  string(8) "stdClass"
}
string(14) "dynamic_member"
public

With Win and PHP 5.2.0 there is no segfault, but the isPublic returned
FALSE!

If you try the getProperty method on the 'dynamic_member', an exception
is still thrown in the snapshot!
----
Fatal error: Uncaught exception 'ReflectionException' with message
'Property dynamic_member does not exist' in /tmp/test.php:5
Stack trace:
#0 /tmp/test.php(5): ReflectionClass->getProperty('dynamic_member')
#1 {main}
  thrown in /tmp/test.php on line 5

------------------------------------------------------------------------

[2007-02-13 09:58:41] [EMAIL PROTECTED]

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



------------------------------------------------------------------------

[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

Reply via email to