mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Fix bug #69891
This commit is contained in:
parent
5bf7a3aac7
commit
e8217a2727
1
NEWS
1
NEWS
@ -24,6 +24,7 @@ PHP NEWS
|
||||
(Christian Wenz)
|
||||
. Fixed bug #69889 (Null coalesce operator doesn't work for string offsets).
|
||||
(Nikita)
|
||||
. Fixed bug #69891 (Unexpected array comparison result). (Nikita)
|
||||
. Fixed bug #69892 (Different arrays compare indentical due to integer key
|
||||
truncation). (Nikita)
|
||||
. Fixed bug #69893 (Strict comparison between integer and empty string keys
|
||||
|
12
Zend/tests/bug69891.phpt
Normal file
12
Zend/tests/bug69891.phpt
Normal file
@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #69891: Unexpected array comparison result
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump([1, 2, 3] <=> []);
|
||||
var_dump([] <=> [1, 2, 3]);
|
||||
var_dump([1] <=> [2, 3]);
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(-1)
|
||||
int(-1)
|
8
Zend/tests/bug69893.phpt
Normal file
8
Zend/tests/bug69893.phpt
Normal file
@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Bug #69893: Strict comparison between integer and empty string keys crashes
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump([0 => 0] === ["" => 0]);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
@ -2220,11 +2220,10 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
|
||||
HASH_PROTECT_RECURSION(ht1);
|
||||
HASH_PROTECT_RECURSION(ht2);
|
||||
|
||||
result = ht1->nNumOfElements - ht2->nNumOfElements;
|
||||
if (result!=0) {
|
||||
if (ht1->nNumOfElements != ht2->nNumOfElements) {
|
||||
HASH_UNPROTECT_RECURSION(ht1);
|
||||
HASH_UNPROTECT_RECURSION(ht2);
|
||||
return result;
|
||||
return ht1->nNumOfElements > ht2->nNumOfElements ? 1 : -1;
|
||||
}
|
||||
|
||||
for (idx1 = 0, idx2 = 0; idx1 < ht1->nNumUsed; idx1++) {
|
||||
|
Loading…
Reference in New Issue
Block a user