diff options
Diffstat (limited to 'ext/spl/php_spl.c')
-rw-r--r-- | ext/spl/php_spl.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 5927e05562..de787ae7b6 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -454,12 +454,24 @@ PHP_FUNCTION(spl_autoload_call) } /* }}} */ #define HT_MOVE_TAIL_TO_HEAD(ht) \ - (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; + do { \ + uint first = 0; \ + uint last = (ht)->nNumUsed; \ + while (first < last) { \ + if ((ht)->arData[first].xData) break; \ + first++; \ + } \ + while (last > first) { \ + last--; \ + if ((ht)->arData[last].xData) break; \ + } \ + if (first != last) { \ + Bucket tmp = (ht)->arData[first]; \ + (ht)->arData[first] = (ht)->arData[last]; \ + (ht)->arData[last] = tmp; \ + zend_hash_rehash(ht); \ + } \ + } while (0) /* {{{ proto bool spl_autoload_register([mixed autoload_function = "spl_autoload" [, throw = true [, prepend]]]) Register given function as __autoload() implementation */ |