php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jay at grooveshark dot com
New email:
PHP Version: OS:

 

 [2010-10-14 02:15 UTC] jay at grooveshark dot com
Description:
------------
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: http://p3n.us/q7



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-19 06:06 UTC] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=304492
Log: Fixed bug #53058 (__autoload example #1)
 [2010-10-19 06:06 UTC] kalle@php.net
-Assigned To: +Assigned To: kalle
 [2010-10-19 06:07 UTC] kalle@php.net
-Status: Assigned +Status: Closed
 [2010-10-19 06:07 UTC] kalle@php.net
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] phpdocbot@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=a2048ed42fe3df85010149ae85e9e01e574f274d
Log: Fixed bug #53058 (__autoload example #1)
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Oct 29 21:01:29 2020 UTC