]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6'
authorNikita Popov <nikic@php.net>
Sat, 20 Jun 2015 14:50:37 +0000 (16:50 +0200)
committerNikita Popov <nikic@php.net>
Sat, 20 Jun 2015 14:50:37 +0000 (16:50 +0200)
Conflicts:
Zend/zend_hash.c

1  2 
NEWS
Zend/zend_hash.c

diff --cc NEWS
index 568a9cec98ce2a44b77c06060a7119b16013d084,45428e34834aa9126eb8dbd891b07be2e6a7fec3..3558a6a7cc88e88905113b8be76e218ec35eff06
--- 1/NEWS
--- 2/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)
  
index 05426412fe0a6a2be516559282122e057e23b129,448824ea1d3d32e54103164312ec90f7a0b60ed4..239fb0bb6bbb6fb77a95b31cb6f00d2db1b7f135
@@@ -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;
                                }
                        }