|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53058 __autoload example #1
Submitted: 2010-10-14 02:15 UTC Modified: 2010-10-19 06:07 UTC
From: jay at grooveshark dot com Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2010-10-14 02:15 UTC] jay at grooveshark dot com
This was rejected as a note from the documentation with no explanation, I assume because it was considered a documentation bug:

Example #1 would be better as:

function __autoload($class_name) {
    include $class_name . '.php';

Making it an include rather than a require makes it a warning if the file fails to load rather than a fatal, and PHP will instead fatal where the class is being used. The net result is that the error logs will report the actual source of the error rather than pointing to the autoloader.
Removing the _once just makes it slightly more efficient since _once is not necessary inside of __autoload because it will only try to load a class if it's not already defined.

More info:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-19 06:06 UTC]
Automatic comment from SVN on behalf of kalle
Log: Fixed bug #53058 (__autoload example #1)
 [2010-10-19 06:06 UTC]
-Assigned To: +Assigned To: kalle
 [2010-10-19 06:07 UTC]
-Status: Assigned +Status: Closed
 [2010-10-19 06:07 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

 [2020-02-07 06:09 UTC]
Automatic comment on behalf of kalle
Log: Fixed bug #53058 (__autoload example #1)
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 09 21:05:53 2022 UTC