Edit report at https://bugs.php.net/bug.php?id=55731&edit=1
ID: 55731
Updated by: stas@php.net
Reported by: 421034509 at qq dot com
Summary: __get after __unset
-Status: Not a bug
+Status: Closed
Type: Bug
Package: Unknown/Other Function
Operating System: windows xp
PHP Version: 5.3.8
-Assigned To:
+Assigned To: stas
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
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/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
fix for bug #63462 should also fix this one.
Previous Comments:
------------------------------------------------------------------------
[2012-11-08 08:13:17] ocramius at gmail dot com
I got pointed here after filing #63462 ( https://bugs.php.net/bug.php?id=63462 ).
Shouldn't the getter_guard be disabled for "\0Example\0p1: (laurence's
example) when already in the context of __get (and similar logic for all the other
magic methods)?
I have absolutely no understanding of PHP internals about this, but I wouldn't expect the magic
getter to work again for the same property when we already know it was the requested one.
This is actually a (quite problematic) bug for me since it denies any action on unset properties,
which is a feature I need when working with proxies.
If I understand this correctly, at https://github.com/php/php-src/blob/6ba376f552238de643a665d355fd5e59c40315b5/Zend/zend_object_handlers.c#L559-572
the guard is used. I don't understand why guard->in_set isn't checked the
second time though. Does zend_get_property_guard retrieve a different item for
different property_info?
------------------------------------------------------------------------
[2011-09-22 03:36:35] 421034509 at qq dot com
Thank you!I got it!
------------------------------------------------------------------------
[2011-09-22 01:28:25] laruence@php.net
No, if the property is private, and the getter is called out of call entry(means
access a private property out of scope), zend vm will return NULL, but
zend_read_property will assume as a "public property name", since PHP is a
flexible language.
------------------------------------------------------------------------
[2011-09-22 01:18:53] 421034509 at qq dot com
When get_property_info successed in the Example class,
if the private property is defined but be unsetted,zend vm return a property info with name
"\0Example\0propertyname",
but if the property is undefined(or defined but not be unsetted),zend vm return a property info with
name "propertyname".
Is that true?
------------------------------------------------------------------------
[2011-09-22 01:17:55] laruence@php.net
because there is no '\0Example\0p3' in property_info of Example class entry
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=55731--
Edit this bug report at https://bugs.php.net/bug.php?id=55731&edit=1