summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-06-20 16:50:37 +0200
committerNikita Popov <nikic@php.net>2015-06-20 16:50:37 +0200
commit9589d26ef3d8500525729bcb78d2d9b1517e2134 (patch)
treee67d79024abdcb10fe9b92a12abe42ea4c7c6db3
parentcc8f2b1bd9d81b03e3a266ae75853c24d1b1dd43 (diff)
parente09d3155a172bdded3cfcff921f676be57ae8d5b (diff)
downloadphp-git-9589d26ef3d8500525729bcb78d2d9b1517e2134.tar.gz
Merge branch 'PHP-5.6'
Conflicts: Zend/zend_hash.c
-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 568a9cec98..3558a6a7cc 100644
--- a/NEWS
+++ b/NEWS
@@ -20,10 +20,12 @@ PHP NEWS
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 #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
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 05426412fe..239fb0bb6b 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -2243,11 +2243,10 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
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);
- return result;
+ return p1->h > p2->h ? 1 : -1;
}
} else { /* string indices */
size_t len0 = (p1->key ? p1->key->len : 0);