Doc #53058 [Asn->Csd]: __autoload example #1
| From: | kalle@php.net | Date: | Tue, 19 Oct 2010 04:07:09 +0000 |
| Subject: | Doc #53058 [Asn->Csd]: __autoload example #1 | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5236@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53058&edit=1
ID: 53058
Updated by: kalle@php.net
Reported by: jay at grooveshark dot com
Summary: __autoload example #1
-Status: Assigned
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Assigned To: kalle
Block user comment: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2010-10-19 06:06:39] 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-14 02:15:10] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53058&edit=1