summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-06-20 16:40:27 +0200
committerNikita Popov <nikic@php.net>2015-06-20 16:40:53 +0200
commite09d3155a172bdded3cfcff921f676be57ae8d5b (patch)
tree24423699fa9cf3aeac5d8e7ff6f15a240651330a
parentbca005c8d9fa047e2d4b0f2496f771f4a74f458d (diff)
parent5fe078abba7dc87ecc05fa3b9bf544867e947567 (diff)
downloadphp-git-e09d3155a172bdded3cfcff921f676be57ae8d5b.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
-rw-r--r--NEWS4
-rw-r--r--Zend/tests/bug69892.phpt10
-rw-r--r--Zend/zend_hash.c5
3 files changed, 15 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index a071212911..45428e3483 100644
--- a/NEWS
+++ b/NEWS
@@ -15,8 +15,10 @@ PHP NEWS
7/8/8.1/10 as "Business"). (Christian Wenz)
. Fixed bug #69740 (finally in generator (yield) swallows exception in
iteration). (Nikita)
- . Fixes bug #69835 (phpinfo() does not report many Windows SKUs).
+ . Fixed bug #69835 (phpinfo() does not report many Windows SKUs).
(Christian Wenz)
+ . Fixed bug #69892 (Different arrays compare indentical due to integer key
+ truncation). (Nikita)
- GD:
. Fixed bug #61221 (imagegammacorrect function loses alpha channel). (cmb)
diff --git a/Zend/tests/bug69892.phpt b/Zend/tests/bug69892.phpt
new file mode 100644
index 0000000000..d14f85fa52
--- /dev/null
+++ b/Zend/tests/bug69892.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #69892: Different arrays compare indentical due to integer key truncation
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
+--FILE--
+<?php
+var_dump([0 => 0] === [0x100000000 => 0]);
+?>
+--EXPECT--
+bool(false)
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index c00012c0a4..448824ea1d 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -1446,11 +1446,10 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
}
if (ordered) {
if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
- result = p1->h - p2->h;
- if (result!=0) {
+ if (p1->h != p2->h) {
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;