note 94441 added to language.oop5.autoload
| From: | khan at swcombine dot com | Date: | Thu, 05 Nov 2009 13:38:53 +0000 |
| Subject: | note 94441 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162414@lists.php.net to get a copy of this message | ||
As an addendum to #91119 I would suggest adding class_exists() into that solution. I've just
implemented autoloading based on the code provided there and ran into a problem where a file had the
same name as a class, existed in the directory structure prior to the file that had the actual class
and as a result was being included first and resulting in a 'class not found' error.
<?php
if(file_exists($path)) {
require_once $path;
if(class_exists($class_name)) {
return;
}
}
?>
----
Server IP: 117.104.162.229
Probable Submitter: 58.7.81.217 (proxied: 58.7.81.217)
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- https://master.php.net/note/edit/94441
Del: integrated -- https://master.php.net/note/delete/94441/integrated
Del: useless -- https://master.php.net/note/delete/94441/useless
Del: bad code -- https://master.php.net/note/delete/94441/bad+code
Del: spam -- https://master.php.net/note/delete/94441/spam
Del: non-english -- https://master.php.net/note/delete/94441/non-english
Del: in docs -- https://master.php.net/note/delete/94441/in+docs
Del: other reasons-- https://master.php.net/note/delete/94441
Reject -- https://master.php.net/note/reject/94441
Search -- https://master.php.net/manage/user-notes.php