From 518ad7039062c3c0245f521df3ee1c55b05e2a8c Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Tue, 9 Jun 2009 01:57:57 +0000 Subject: [PATCH] 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. --- ext/spl/php_spl.c | 1 + ext/spl/tests/bug48493.phpt | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 ext/spl/tests/bug48493.phpt diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 2ffb4d89bb..a9f954aa6e 100755 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -409,6 +409,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; diff --git a/ext/spl/tests/bug48493.phpt b/ext/spl/tests/bug48493.phpt new file mode 100644 index 0000000000..eee925902c --- /dev/null +++ b/ext/spl/tests/bug48493.phpt @@ -0,0 +1,26 @@ +--TEST-- +SPL: Bug #48493 spl_autoload_unregister() can't handle prepended functions +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + unicode(9) "autoload1" + [1]=> + unicode(9) "autoload2" +} +array(1) { + [0]=> + unicode(9) "autoload1" +} -- 2.50.1