RE: [PHP-DEV] zend guard
| From: | Clint M Priest | Date: | Mon, 30 Jan 2012 20:47:43 +0000 |
| Subject: | RE: [PHP-DEV] zend guard | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-57582@lists.php.net to get a copy of this message | ||
That's exactly what it's used for.
-----Original Message-----
From: julienpauli@gmail.com [mailto:julienpauli@gmail.com] On Behalf Of jpauli
Sent: Monday, January 30, 2012 10:27 AM
To: Adi Mutu
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] zend guard
Quickly reading the source and trying things, I suggest its a guard against recursion in __get and
__set handlers.
This way, code such this one won't infinitly loop :
class Foo {
public function __get($p) {
return $this->$p; // this should lead to a recursion loop
}
}
$f = new Foo;
echo $f->barbaz;
http://lxr.php.net/opengrok/xref/PHP_5_4/Zend/zend_object_handlers.c#440
http://lxr.php.net/opengrok/xref/PHP_5_4/Zend/zend_object_handlers.c#zend_get_property_guard
http://lxr.php.net/xref/PHP_5_4/Zend/zend.h#290
Julien.P
On Mon, Jan 30, 2012 at 5:11 PM, Adi Mutu <adi_mutu06@yahoo.com> wrote:
> Hello,
>
> Can anybody tell me what this struct is used for ?
> I'm new to the internals of php.
>
> Thanks,
> A
>