mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
MFH Fix bug #48493 - spl_autoload_register can leave the HT in an inconsistent way.
Need to point the second elements previous item to head so we can traverse upwards.
This commit is contained in:
parent
cf1a08e317
commit
fc8426ad31
@ -415,6 +415,7 @@ PHP_FUNCTION(spl_autoload_call)
|
||||
(ht)->pListTail->pListNext = (ht)->pListHead; \
|
||||
(ht)->pListHead = (ht)->pListTail; \
|
||||
(ht)->pListTail = (ht)->pListHead->pListLast; \
|
||||
(ht)->pListHead->pListNext->pListLast = (ht)->pListHead;\
|
||||
(ht)->pListTail->pListNext = NULL; \
|
||||
(ht)->pListHead->pListLast = NULL;
|
||||
|
||||
|
26
ext/spl/tests/bug48493.phpt
Normal file
26
ext/spl/tests/bug48493.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
SPL: Bug #48493 spl_autoload_unregister() can't handle prepended functions
|
||||
--FILE--
|
||||
<?php
|
||||
function autoload1() {}
|
||||
|
||||
function autoload2() {}
|
||||
|
||||
spl_autoload_register('autoload2');
|
||||
spl_autoload_register('autoload1', true, true);
|
||||
var_dump(spl_autoload_functions());
|
||||
|
||||
spl_autoload_unregister('autoload2');
|
||||
var_dump(spl_autoload_functions());
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(9) "autoload1"
|
||||
[1]=>
|
||||
string(9) "autoload2"
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(9) "autoload1"
|
||||
}
|
Loading…
Reference in New Issue
Block a user