#49618 [NEW]: spl_autoload_register destroys __autoload hook
| From: | jost dot boekemeier at googlemail dot com | Date: | Tue, 22 Sep 2009 05:24:02 +0000 |
| Subject: | #49618 [NEW]: spl_autoload_register destroys __autoload hook | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-142650@lists.php.net to get a copy of this message | ||
From: jost dot boekemeier at googlemail dot com
Operating system: Any
PHP version: 5.2.11
PHP Bug Type: SPL related
Bug description: spl_autoload_register destroys __autoload hook
Description:
------------
The first call to spl_autoload_register destroys an existing __autoload
hook.
Please either deprecate __autoload and/or register __autoload with
spl_autoload.
Complete problem description is here:
http://sourceforge.net/mailarchive/forum.php?
thread_name=3afa16cf0909210312v3e102491n18701bcca0f5e030%40mail.gmail.com
&forum_name=php-java-bridge-users
Reproduce code:
---------------
<?php
function autoload_legacy($x) {echo "legacy "; return false;}
function autoload_spl1($x) {echo "spl1 "; return false;}
function autoload_spl2($x) {echo "spl2 "; return false;}
function autoload_spl3($x) {echo "spl3 "; return false;}
spl_autoload_register("autoload_spl1");
function __autoload($x) {return autoload_legacy($x);}
spl_autoload_register("autoload_spl2");
spl_autoload_register("autoload_spl3");
@new Foo();
?>
Expected result:
----------------
spl1 spl2 spl3 legacy
Actual result:
--------------
spl1 spl2 spl3
--
Edit bug report at http://bugs.php.net/?id=49618&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49618&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49618&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49618&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49618&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49618&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49618&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49618&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49618&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49618&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49618&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49618&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49618&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49618&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49618&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49618&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49618&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49618&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49618&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49618&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49618&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49618&r=mysqlcfg