Skip to content

Commit 5fe078a

Browse files
committed
Fixed bug #69892
1 parent 6a8db93 commit 5fe078a

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

NEWS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
fault). (Christoph M. Becker)
1414
. Fixed bug #69781 (phpinfo() reports Professional Editions of Windows
1515
7/8/8.1/10 as "Business"). (Christian Wenz)
16-
. Fixes bug #69835 (phpinfo() does not report many Windows SKUs).
16+
. Fixed bug #69835 (phpinfo() does not report many Windows SKUs).
1717
(Christian Wenz)
18+
. Fixed bug #69892 (Different arrays compare indentical due to integer key
19+
truncation). (Nikita)
1820

1921
- GD:
2022
. Fixed bug #61221 (imagegammacorrect function loses alpha channel). (cmb)

Zend/tests/bug69892.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Bug #69892: Different arrays compare indentical due to integer key truncation
3+
--SKIPIF--
4+
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
5+
--FILE--
6+
<?php
7+
var_dump([0 => 0] === [0x100000000 => 0]);
8+
?>
9+
--EXPECT--
10+
bool(false)

Zend/zend_hash.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,11 +1534,10 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
15341534
}
15351535
if (ordered) {
15361536
if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
1537-
result = p1->h - p2->h;
1538-
if (result!=0) {
1537+
if (p1->h != p2->h) {
15391538
HASH_UNPROTECT_RECURSION(ht1);
15401539
HASH_UNPROTECT_RECURSION(ht2);
1541-
return result;
1540+
return p1->h > p2->h ? 1 : -1;
15421541
}
15431542
} else { /* string indices */
15441543
result = p1->nKeyLength - p2->nKeyLength;

0 commit comments

Comments
 (0)