com php-src: Merge branch 'PHP-5.6': NEWS Zend/zend_hash.c
| From: | Nikita Popov | Date: | Sat, 20 Jun 2015 14:50:37 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6': NEWS Zend/zend_hash.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87408@lists.php.net to get a copy of this message | ||
Commit: 9589d26ef3d8500525729bcb78d2d9b1517e2134
Author: Nikita Popov <nikic@php.net> Sat, 20 Jun 2015 16:50:37 +0200
Parents: cc8f2b1bd9d81b03e3a266ae75853c24d1b1dd43 e09d3155a172bdded3cfcff921f676be57ae8d5b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9589d26ef3d8500525729bcb78d2d9b1517e2134
Log:
Merge branch 'PHP-5.6'
Conflicts:
Zend/zend_hash.c
Changed paths:
MM NEWS
MM Zend/zend_hash.c
Diff:
diff --cc NEWS
index 568a9ce,45428e3..3558a6a
--- a/NEWS
+++ b/NEWS
@@@ -20,15 -13,13 +20,17 @@@ PH
fault). (Christoph M. Becker)
. Fixed bug #69781 (phpinfo() reports Professional Editions of Windows
7/8/8.1/10 as "Business"). (Christian Wenz)
- . Fixes bug #69835 (phpinfo() does not report many Windows SKUs).
- . Fixed bug #69740 (finally in generator (yield) swallows exception in
- iteration). (Nikita)
+ . Fixed bug #69835 (phpinfo() does not report many Windows SKUs).
(Christian Wenz)
+ . Fixed bug #69889 (Null coalesce operator doesn't work for string offsets).
+ (Nikita)
+ . Fixed bug #69892 (Different arrays compare indentical due to integer key
+ truncation). (Nikita)
+- DOM:
+ . Fixed bug #69846 (Segmenation fault (access violation) when iterating over
+ DOMNodeList). (Anatol Belski)
+
- GD:
. Fixed bug #61221 (imagegammacorrect function loses alpha channel). (cmb)
diff --cc Zend/zend_hash.c
index 0542641,448824e..239fb0b
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@@ -2227,40 -1433,35 +2227,39 @@@ ZEND_API int zend_hash_compare(HashTabl
return result;
}
- p1 = ht1->pListHead;
- if (ordered) {
- p2 = ht2->pListHead;
- }
+ for (idx1 = 0, idx2 = 0; idx1 < ht1->nNumUsed; idx1++) {
+ p1 = ht1->arData + idx1;
+ if (Z_TYPE(p1->val) == IS_UNDEF) continue;
- while (p1) {
- if (ordered && !p2) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 1; /* That's not supposed to happen */
- }
if (ordered) {
- if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
+ while (1) {
+ p2 = ht2->arData + idx2;
+ if (idx2 == ht2->nNumUsed) {
+ HASH_UNPROTECT_RECURSION(ht1);
+ HASH_UNPROTECT_RECURSION(ht2);
+ return 1; /* That's not supposed to happen */
+ }
+ if (Z_TYPE(p2->val) != IS_UNDEF) break;
+ idx2++;
+ }
+ if (p1->key == NULL && p2->key == NULL) { /* numeric indices */
- result = p1->h - p2->h;
- if (result != 0) {
+ if (p1->h != p2->h) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
+ HASH_UNPROTECT_RECURSION(ht1);
+ HASH_UNPROTECT_RECURSION(ht2);
- return result;
+ return p1->h > p2->h ? 1 : -1;
}
} else { /* string indices */
- result = p1->nKeyLength - p2->nKeyLength;
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return result;
+ size_t len0 = (p1->key ? p1->key->len : 0);
+ size_t len1 = (p2->key ? p2->key->len : 0);
+ if (len0 != len1) {
+ HASH_UNPROTECT_RECURSION(ht1);
+ HASH_UNPROTECT_RECURSION(ht2);
+ return len0 > len1 ? 1 : -1;
}
- result = memcmp(p1->arKey, p2->arKey, p1->nKeyLength);
- if (result!=0) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
+ result = memcmp(p1->key->val, p2->key->val, p1->key->len);
+ if (result != 0) {
+ HASH_UNPROTECT_RECURSION(ht1);
+ HASH_UNPROTECT_RECURSION(ht2);
return result;
}
}