From: Nikita Popov Date: Sat, 20 Jun 2015 14:50:37 +0000 (+0200) Subject: Merge branch 'PHP-5.6' X-Git-Tag: php-7.0.0alpha2~2^2~47 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9589d26ef3d8500525729bcb78d2d9b1517e2134;p=php Merge branch 'PHP-5.6' Conflicts: Zend/zend_hash.c --- 9589d26ef3d8500525729bcb78d2d9b1517e2134 diff --cc NEWS index 568a9cec98,45428e3483..3558a6a7cc --- 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 05426412fe,448824ea1d..239fb0bb6b --- 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; } }