Doc #60208 [NEW]: Document behavior of magic methods when called inside another magic method

From: Date: Thu, 03 Nov 2011 12:14:13 +0000
Subject: Doc #60208 [NEW]: Document behavior of magic methods when called inside another magic method
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7381@lists.php.net to get a copy of this message
From: Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:Document behavior of magic methods when called inside another magic method 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? -- Edit bug report at https://bugs.php.net/bug.php?id=60208&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60208&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60208&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60208&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60208&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60208&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60208&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60208&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60208&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60208&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60208&r=support Expected behavior: https://bugs.php.net/fix.php?id=60208&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60208&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60208&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60208&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60208&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60208&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60208&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60208&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60208&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60208&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60208&r=mysqlcfg

« previous php.doc.bugs (#7381) next »