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

From: Date: Thu, 14 Jul 2011 12:24:31 +0000
Subject: Doc #55207 [Opn]: overload() example not working, incomprehensible documentation
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6878@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55207&edit=1 ID: 55207 Updated by: rquadling@php.net Reported by: jo at feuersee dot de Summary: overload() example not working, incomprehensible documentation Status: Open Type: Documentation Problem Package: Documentation problem Operating System: irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: The overload() function was removed after PHP V4.3.0 (see the version data on http://de3.php.net/manual/en/function.overload.php), so it no longer exists. As such, I think the entire http://docs.php.net/manual/en/book.overload.php section should be removed as the functionality (__get(), __set(), __call(), etc.) has been incorporated into PHP. Previous Comments: ------------------------------------------------------------------------ [2011-07-14 07:59:52] jo at feuersee dot de 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 this bug report at https://bugs.php.net/bug.php?id=55207&edit=1

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