Sorry I guess I should have been more clear. The recursion would prevent the accessor from being called which would allow the ordinary property code to execute, thus accessing the property directly. I suppose if it were in a setter and the property were not defined by the accessor then it would automagically create a public property, not that it would matter if accessors always shadowed properties because the access control of the accessor would still prevail.

But it could be written such that an accessor would define a private property upon set from within the setter.

Recursion guarding in this case simply means that the get/set is guarded from being called more than once. It's the same mechanism that __get and __set use.

On Saturday, October 27, 2012 3:20:38 PM, Stas Malyshev wrote:
Hi!

Recursion is guarded by the same mechanism __get uses to avoid recursion.

__get on recursion returns undefined, __set on recursion does nothing.
However you're saying "No direct access to the property would be allowed
except from within the accessor" - but what this not allowing means?
Just returning undefined if __getHours was previously called?


--
-Clint


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to