Doc #55207 [NEW]: overload() example not working, incomprehensible documentation

From: Date: Thu, 14 Jul 2011 11:59:52 +0000
Subject: Doc #55207 [NEW]: overload() example not working, incomprehensible documentation
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6877@lists.php.net to get a copy of this message
From: Operating system: irrelevant PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:overload() example not working, incomprehensible documentation Description: ------------ The example on using the overload() function <http://de3.php.net/manual/en/overload.examples.basic.php> fails with a recent PHP/5.3.* Fatal error: Method OO::__get() must take exactly 1 argument in /home/jo/www/test/overload.php on line 16 Besides, neither the example nor the function documentation <http://de3.php.net/manual/en/function.overload.php> explains what overload() is supposed to do. All the functionality in the example is in the magic methods __get() and __set(), so what exactly is overload('classname') supposed to do? I asked this yesterday at a PHPUG meeting and nobody knew, has ever used or even heard about it. I grep'd PHP code and the only real life usage I found was in PEAR/Autoloader.php which most likely never gets included (at least with PHP5) as it dies on a missing overload() function. Which turned out to be the case at least with recent openSUSE and Debian packages. My guess is that it's a workaround for missing magic methods in PHP < 5.0 which applies some magic on classes to implement method overloading as described in <http://de3.php.net/manual/en/language.oop5.overloading.php> If so, it should be documented and marked as deprecated since PHP5. IMHO having bad or misleading documentation is worse than having none. Just think of some poor newbie trying to use it. If not, the documentation should be rewritten to actually make sense. EDIT: when submitting this, the friendly bug tracker led me to <https://bugs.php.net/bug.php?id=41472> and now I'm even more confused. How is this supposed to work? Does using the overload extension change the magic __get() method prototype? What for, what can be done with overload() but not with std __get() and __set()? Pls help -- Edit bug report at https://bugs.php.net/bug.php?id=55207&edit=1 -- Try a snapshot (PHP 5.2): https://bugs.php.net/fix.php?id=55207&r=trysnapshot52 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55207&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55207&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55207&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55207&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55207&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55207&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55207&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55207&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55207&r=support Expected behavior: https://bugs.php.net/fix.php?id=55207&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55207&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55207&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55207&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55207&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55207&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55207&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55207&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55207&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55207&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55207&r=mysqlcfg Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55207&r=trysnapshot54

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