com php-src: Fixed callback registraion order in spl_autoload _register(): ext/spl/php_spl.c
| From: | Dmitry Stogov | Date: | Tue, 29 Jul 2014 12:23:56 +0000 |
| Subject: | com php-src: Fixed callback registraion order in spl_autoload _register(): ext/spl/php_spl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79612@lists.php.net to get a copy of this message | ||
Commit: 46fcd3fc08de938293a8a4fe25f9d1ed18457f4a
Author: Dmitry Stogov <dmitry@zend.com> Tue, 29 Jul 2014 16:23:56 +0400
Parents: 507e3b91930835b698a29bfa7ba978470d6302ef
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=46fcd3fc08de938293a8a4fe25f9d1ed18457f4a
Log:
Fixed callback registraion order in spl_autoload_register()
Changed paths:
M ext/spl/php_spl.c
Diff:
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index d765d6b..62cf6ae 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -441,24 +441,11 @@ PHP_FUNCTION(spl_autoload_call)
#define HT_MOVE_TAIL_TO_HEAD(ht) \
do { \
- uint first = 0; \
- uint last = (ht)->nNumUsed; \
- while (first < last) { \
- if (Z_TYPE((ht)->arData[first].val) != IS_UNDEF) \
- break; \
- first++; \
- } \
- while (last > first) { \
- last--; \
- if (Z_TYPE((ht)->arData[last].val) != IS_UNDEF) \
- break; \
- } \
- if (first != last) { \
- Bucket tmp = (ht)->arData[first]; \
- (ht)->arData[first] = (ht)->arData[last]; \
- (ht)->arData[last] = tmp; \
- zend_hash_rehash(ht); \
- } \
+ Bucket tmp = (ht)->arData[(ht)->nNumUsed-1]; \
+ memmove((ht)->arData + 1, (ht)->arData, \
+ sizeof(Bucket) * ((ht)->nNumUsed - 1)); \
+ (ht)->arData[0] = tmp; \
+ zend_hash_rehash(ht); \
} while (0)
/* {{{ proto bool spl_autoload_register([mixed autoload_function = "spl_autoload" [,
throw = true [, prepend]]])