Doc #53058 [NEW]: __autoload example #1
| From: | jay at grooveshark dot com | Date: | Thu, 14 Oct 2010 00:15:13 +0000 |
| Subject: | Doc #53058 [NEW]: __autoload example #1 | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-5210@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:__autoload example #1
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 bug report at http://bugs.php.net/bug.php?id=53058&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53058&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53058&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53058&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53058&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53058&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53058&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53058&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53058&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53058&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53058&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53058&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53058&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53058&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53058&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53058&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53058&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53058&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53058&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53058&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53058&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53058&r=mysqlcfg