ID:               49618
 Updated by:       sjo...@php.net
 Reported By:      jost dot boekemeier at googlemail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         SPL related
 Operating System: Any
 PHP Version:      5.2.11
 New Comment:

Thank you for your report.

I do not think the behavior you describe is a bug. The documentation is
clear about this:
"If your code has an existing __autoload function then this function
must be explicitly registered on the __autoload stack. This is because
spl_autoload_register() will effectively replace the engine cache for
the __autoload function by either spl_autoload() or
spl_autoload_call()."

Thus, calling spl_autoload_register() replaces __autoload().


Previous Comments:
------------------------------------------------------------------------

[2009-09-22 05:24:02] jost dot boekemeier at googlemail dot com

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 this bug report at http://bugs.php.net/?id=49618&edit=1

Reply via email to