note 92062 added to function.spl-autoload-unregister
| From: | JulienB dot at osu1 dot php dot net | Date: | Tue, 07 Jul 2009 16:31:45 +0000 |
| Subject: | note 92062 added to function.spl-autoload-unregister | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158021@lists.php.net to get a copy of this message | ||
Restore the binding to __autoload after using a spl_autoload_register() call
<?php
spl_autoload_register(array('Doctrine', 'autoload'));
// some process
spl_autoload_unregister(array('Doctrine', 'autoload'));
// but now the old __autoload is not triggered anymore
// you need to use :
spl_autoload_register('__autoload');
// but this will throw a LogicExeption if the __autoload
// function is not defined yet, so use:
function autoload__ ( $className ) {
if ( function_exists('__autoload'))
__autoload($className);
}
spl_autoload_register('autoload__');
?>
So you can define your old __autoload in another file for example
May helps some folks in this catch 22
----
Server IP: 92.48.74.199
Probable Submitter: 217.40.141.78
----
Manual Page -- http://www.php.net/manual/en/function.spl-autoload-unregister.php
Edit -- https://master.php.net/note/edit/92062
Del: integrated -- https://master.php.net/note/delete/92062/integrated
Del: useless -- https://master.php.net/note/delete/92062/useless
Del: bad code -- https://master.php.net/note/delete/92062/bad+code
Del: spam -- https://master.php.net/note/delete/92062/spam
Del: non-english -- https://master.php.net/note/delete/92062/non-english
Del: in docs -- https://master.php.net/note/delete/92062/in+docs
Del: other reasons-- https://master.php.net/note/delete/92062
Reject -- https://master.php.net/note/reject/92062
Search -- https://master.php.net/manage/user-notes.php