ID: 29070 User updated by: csmoak at andrew dot cmu dot edu Reported By: csmoak at andrew dot cmu dot edu Status: Open -Bug Type: Feature/Change Request +Bug Type: Class/Object related Operating System: All PHP Version: 5.0.0RC3 New Comment:
This really should be taken care of. Previous Comments: ------------------------------------------------------------------------ [2004-07-09 06:57:23] csmoak at andrew dot cmu dot edu Description: ------------ __get() and __set() are currently blocked from being implicitly called for a particular instance of an object when they are currently executing. However, this can cause code to behave differently if it is called from within __get()/__set() or if it is called without __get()/__set(). The following example uses good OOP methodology that tries to make use of __get() and __set(), but is hindered by it, instead. The problem lies in the use of the in_get and in_set member variables in the zend_object strcut to provide a blanket block to calling __get or __set recursively (when called implicitly). A possible solution would be to only prevent code directly in the __get() and __set() method bodies from implicitly calling __get() or __set(), but allowing it in any called code. Reproduce code: --------------- http://www.andrew.cmu.edu/user/csmoak/getset.phps Expected result: ---------------- correct behavior (without making use of __get/__set):<br> before set : default<br> after set : propertyValue<br> PropertyAccessClass Object ( [property:private] => propertyValue [defaultProperty:private] => default [changed:private] => 1 ) <br><br> incorrect behavior (making use of __get/__set):<br> before set : default<br> after set : propertyValue<br> PropertyAccessClass Object ( [property:private] => propertyValue [defaultProperty:private] => default [changed:private] => 1 ) Actual result: -------------- correct behavior (without making use of __get/__set):<br> before set : default<br> after set : propertyValue<br> PropertyAccessClass Object ( [property:private] => propertyValue [defaultProperty:private] => default [changed:private] => 1 ) <br><br> incorrect behavior (making use of __get/__set):<br> <br /> <b>Notice</b>: Undefined property: PropertyAccessClass::$PropertyChanged in <b>C:\ftproot\pnet\test2.php</b> on line <b>22</b><br /> <br /> <b>Notice</b>: Undefined property: PropertyAccessClass::$DefaultProperty in <b>C:\ftproot\pnet\test2.php</b> on line <b>33</b><br /> before set : <br> after set : propertyValue<br> PropertyAccessClass Object ( [property:private] => propertyValue [defaultProperty:private] => default [changed:private] => [PropertyChanged] => 1 ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29070&edit=1