|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-28 11:35 UTC] cmb@php.net
-Package: Documentation problem
+Package: Class/Object related
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 15:00:01 2025 UTC |
Description: ------------ There seems to be a safeguard in PHP5 against infinite magic method recursion in __get etc., but this is totally missing from the documentation ( php.net/manual/en/language.oop5.overloading.php ), making the more complex uses of setters/getters very fragile. A few questions I would expect to be answered in such a documentation: * does the magic method get fired when I use overloading inside a magic method of the same type? (e.g. will $val = $this->bar inside __get('bar') call __get('bar') again?) * does the magic method get fired when I use overloading inside a magic method of another type (e.g. will $val = $this->bar inside __isset('bar') call __get('bar')? Looks like it doesn't, which seems counterintuitive to me.) * does the magic method get fired when I use overloading inside a magic method, but call that magic method manually? (ie. does it matter whether I call the magic method with $this->bar or with $this->__get('bar')?) * does it matter whether the magic method is present in the call chain, or just the current method matters? Eg. in this class: <?php class Foo { function __isset($name) { $val = $this->bar('name'); return isset($val); } function bar($name) { return $this->$name; } } ?> will isset($foo->bar) call Foo::__get('bar') or not?