scottmac Tue Jun 9 01:58:07 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests bug48493.phpt
Modified files:
/php-src/ext/spl php_spl.c
Log:
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.
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.36&r2=1.52.2.28.2.17.2.37&diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.36
php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.37
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.36 Mon Apr 20 14:20:20 2009
+++ php-src/ext/spl/php_spl.c Tue Jun 9 01:58:07 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_spl.c,v 1.52.2.28.2.17.2.36 2009/04/20 14:20:20 colder Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.17.2.37 2009/06/09 01:58:07 scottmac Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -415,6 +415,7 @@
(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;
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug48493.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug48493.phpt
+++ php-src/ext/spl/tests/bug48493.phpt
--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]=>
unicode(9) "autoload1"
[1]=>
unicode(9) "autoload2"
}
array(1) {
[0]=>
unicode(9) "autoload1"
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php