Bug #53931 [Fbk->NoF]: read_property not invoked on write thru a nested object
| From: | php-bugs at lists dot php dot net | Date: | Mon, 18 Feb 2013 00:34:41 +0000 |
| Subject: | Bug #53931 [Fbk->NoF]: read_property not invoked on write thru a nested object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176957@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53931&edit=1
ID: 53931
Updated by: php-bugs@lists.php.net
Reported by: mark dot rhoads at rightnow dot com
Summary: read_property not invoked on write thru a nested
object
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Class/Object related
Operating System: *nix
PHP Version: 5.3.5
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2011-02-05 03:39:54] cataphract@php.net
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
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=53931&edit=1