note 96952 added to function.spl-autoload-register
| From: | sebastian dot krebs at kingcrunch dot de | Date: | Wed, 24 Mar 2010 18:54:17 +0000 |
| Subject: | note 96952 added to function.spl-autoload-register | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167360@lists.php.net to get a copy of this message | ||
It seems, that spl_autoload tests, if the class exists, after calling every registered loader. So
it breaks the chain, if the class exists and will not call the other loaders
<?php
function a ($c) {
echo "a\n";
class Bla {} // Usually "include 'path/to/file.php';"
}
function b ($c) {
echo "b\n";
}
spl_autoload_register('a');
spl_autoload_register('b');
$c = new Bla();
----
Server IP: 69.147.83.197
Probable Submitter: 85.178.161.180
----
Manual Page -- http://www.php.net/manual/en/function.spl-autoload-register.php
Edit -- https://master.php.net/note/edit/96952
Del: integrated -- https://master.php.net/note/delete/96952/integrated
Del: useless -- https://master.php.net/note/delete/96952/useless
Del: bad code -- https://master.php.net/note/delete/96952/bad+code
Del: spam -- https://master.php.net/note/delete/96952/spam
Del: non-english -- https://master.php.net/note/delete/96952/non-english
Del: in docs -- https://master.php.net/note/delete/96952/in+docs
Del: other reasons-- https://master.php.net/note/delete/96952
Reject -- https://master.php.net/note/reject/96952
Search -- https://master.php.net/manage/user-notes.php