scottmac                Tue Jun  9 01:57:58 2009 UTC

  Added files:                 
    /php-src/ext/spl/tests      bug48493.phpt 

  Modified files:              
    /php-src/ext/spl    php_spl.c 
  Log:
  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.157&r2=1.158&diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.157 php-src/ext/spl/php_spl.c:1.158
--- php-src/ext/spl/php_spl.c:1.157     Mon May 25 14:32:14 2009
+++ php-src/ext/spl/php_spl.c   Tue Jun  9 01:57:57 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_spl.c,v 1.157 2009/05/25 14:32:14 felipe Exp $ */
+/* $Id: php_spl.c,v 1.158 2009/06/09 01:57:57 scottmac Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -409,6 +409,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

Reply via email to