diff options
author | Nikita Popov <nikic@php.net> | 2015-06-20 16:39:23 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-06-20 16:40:14 +0200 |
commit | 5fe078abba7dc87ecc05fa3b9bf544867e947567 (patch) | |
tree | 2aef9e24daac100f373b5b4c4d719ee2f4ce53e4 | |
parent | 6a8db931158a73398135e8f9fd3a050de36dd246 (diff) | |
download | php-git-5fe078abba7dc87ecc05fa3b9bf544867e947567.tar.gz |
Fixed bug #69892
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | Zend/tests/bug69892.phpt | 10 | ||||
-rw-r--r-- | Zend/zend_hash.c | 5 |
3 files changed, 15 insertions, 4 deletions
@@ -13,8 +13,10 @@ 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 #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 b18fd59da8..065172c12a 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -1534,11 +1534,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; |