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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC