kphp icon indicating copy to clipboard operation
kphp copied to clipboard

ksort work incorrectly with PHP 8 string to number comparison behavior

Open i582 opened this issue 4 years ago • 1 comments

Example:

<?php

$array = [700 => 0, "600" => 1, "goo" => 2, "aaa" => 3];
ksort($array);
print_r($array);

If you run KPHP with PHP 8 behavior, the result is different from PHP 8.

See https://wiki.php.net/rfc/string_to_number_comparison See https://github.com/VKCOM/kphp/pull/298

i582 avatar Aug 08 '22 10:08 i582

This was a bug in PHP 8. Here is our pr in php-src

astrophysik avatar Aug 18 '22 15:08 astrophysik