Bug #53931 [Opn]: read_property not invoked on write thru a nested object
| From: | cataphract@php.net | Date: | Sat, 05 Feb 2011 02:39:55 +0000 |
| Subject: | Bug #53931 [Opn]: read_property not invoked on write thru a nested object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-158504@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53931&edit=1
ID: 53931
Updated by: cataphract@php.net
Reported by: mark dot rhoads at rightnow dot com
Summary: read_property not invoked on write thru a nested
object
Status: Open
Type: Bug
Package: Class/Object related
Operating System: *nix
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
Can you give an example with which to reproduce this?
This really looks like a bug on your part, namely failing to adapt
get_property_ptr_ptr. See
http://wiki.php.net/internals/engine/objects#get_property_ptr_ptr
Previous Comments:
------------------------------------------------------------------------
[2011-02-04 22:06:12] mark dot rhoads at rightnow dot com
Description:
------------
I have a custom object implementation with its own read_property and
write_property handlers where some properties are also objects.
Attemptying to write a property within the nested object when the nested
object has not been previously accessed via read_property will cause a
stdClass object to be invented and assigned to the property instead of
calling read_property to get the underlying object.
If the the first access is a write to a property of a nested object,
then read_property is not called for the nested object and a stdClass
object is invented and assigned:
$obj->nestedObject->someProperty = someValue;
assert( 'stdClass' == get_class( $obj->nestedObject ) );
However, if the first access is a read then it all works fine:
$someValue = $obj->nestedObject->someProperty; // read_property is
called for nestedObject
$obj->nestedObject->someProperty = someValue; // and now the write
works
First performing any kind of read access allows this to work just fine.
E.g. this works
$obj->nestedObject;
$obj->nestedObject->someProperty = someValue;
Or this:
$avalue = $obj->nestedObject->someProperty; // calls read_property on
nestedObject
$obj->nestedObject->someProperty = someValue;
The problem only occurs when the very first access is a write to a
properpty of the nested property.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53931&edit=1