php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55207 overload() example not working, incomprehensible documentation
Submitted: 2011-07-14 07:59 UTC Modified: 2011-08-17 12:32 UTC
From: jo at feuersee dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: irrelevant
Private report: No CVE-ID: None
 [2011-07-14 07:59 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-14 08:24 UTC] rquadling@php.net
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.
 [2011-08-17 12:32 UTC] bjori@php.net
-Status: Open +Status: Bogus
 [2011-08-17 12:32 UTC] bjori@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

right, that document describes php4.

We keep old docs around because unfortunately people still exist that use php4.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 05:00:01 2026 UTC