ID:               40091
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dweller at devonweller dot com
-Status:           Open
+Status:           Closed
 Bug Type:         SPL related
 Operating System: Mac OS X
 PHP Version:      5.2.0
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip




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

[2007-01-10 15:20:23] dweller at devonweller dot com

Description:
------------
When using spl_autoload_register with two instances of the same class
name, the autoload stack only stores one function callback instead of
two.


Reproduce code:
---------------
class MyAutoloader {
        function __construct($directory_to_use) {}
        function autoload($class_name) {
                // code to autoload based on directory
        }
}

$autloader1 = new MyAutoloader('dir1');
spl_autoload_register(array($autloader1, 'autoload'));

$autloader2 = new MyAutoloader('dir2');
spl_autoload_register(array($autloader2, 'autoload'));

print_r(spl_autoload_functions());


Expected result:
----------------
Array
(
    [0] => Array
        (
            [0] => MyAutoloader
            [1] => autoload
        )

    [1] => Array
        (
            [0] => MyAutoloader
            [1] => autoload
        )

)


Actual result:
--------------
Array
(
    [0] => Array
        (
            [0] => MyAutoloader
            [1] => autoload
        )

)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40091&edit=1

Reply via email to