#48493 [Opn->Csd]: spl_autoload_unregister() removes all autoloaded methods when prepending
| From: | scottmac@php.net | Date: | Tue, 09 Jun 2009 01:58:19 +0000 |
| Subject: | #48493 [Opn->Csd]: spl_autoload_unregister() removes all autoloaded methods when prepending | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-138122@lists.php.net to get a copy of this message | ||
ID: 48493
Updated by: scottmac@php.net
Reported By: craig dot marvelley at boxuk dot com
-Status: Open
+Status: Closed
Bug Type: SPL related
Operating System: Windows XP
PHP Version: 5.3.0RC2
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-06-08 08:20:05] craig dot marvelley at boxuk dot com
Description:
------------
The spl_autoload_register function was recently modified (I don't think
it's documented, though) to allow the pre-pending of functions to the
stack (see bug #42823).
I'm using pre-pending and am later trying to remove a registered
function from the end of the stack. This removes ALL methods, not just
the method I'd intended.
Reproduce code:
---------------
function autoload1() {}
function autoload2() {}
spl_autoload_register('autoload2');
// register autoload1 at the bottom of the stack
spl_autoload_register('autoload1', true, true);
// Output: Array ( [0] => autoload1 [1] => autoload2 )
print_r(spl_autoload_functions());
// unregister autoload2 - autoload1 _should_ be left behind
spl_autoload_unregister('autoload2');
Expected result:
----------------
When running spl_autoload_functions(), I'd expect a single entry to be
left: array([0] => 'autoload1');
Actual result:
--------------
The array is empty: array();
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48493&edit=1