Fix GH-13309 and GH-13310: array hashes comparison, wrong buffer len calculation.

php_array_key_compare_string_case_unstable_i has a typo for the second
operand resulting in a wrong buffer size calculation.

Issue reported by @AlexRudyuk

Close GH-13315
This commit is contained in:
David Carlier 2024-02-03 11:42:09 +00:00
parent 7d5a96614c
commit d91224cd2f
2 changed files with 5 additions and 1 deletions

4
NEWS
View file

@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.2.17
- Core:
. Fixed array key as string (case insensitive) comparison typo
for the second operand buffer size. (A. Slepykh)
- Curl:
. Fix failing tests due to string changes in libcurl 8.6.0. (Ayesh)

View file

@ -188,7 +188,7 @@ static zend_always_inline int php_array_key_compare_string_case_unstable_i(Bucke
l2 = s->key->len;
} else {
s2 = zend_print_long_to_buf(buf2 + sizeof(buf2) - 1, s->h);
l2 = buf2 + sizeof(buf2) - 1 - s1;
l2 = buf2 + sizeof(buf2) - 1 - s2;
}
return zend_binary_strcasecmp_l(s1, l1, s2, l2);
}