bug77395.phpt 549 B

123456789101112131415161718192021
  1. --TEST--
  2. Bug #77395 (segfault about array_multisort)
  3. --FILE--
  4. <?php
  5. function error_handle($level, $message, $file = '', $line = 0){
  6. $a = [1,2,3];
  7. $b = [3,2,1];
  8. echo $message;
  9. array_multisort($a, SORT_ASC, $b); // if comment this line, no segfault happen
  10. }
  11. set_error_handler('error_handle');
  12. $data = [['aa'=> 'bb',], ['aa'=> 'bb',],];
  13. try {
  14. array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error
  15. } catch (\ValueError $e) {
  16. echo $e->getMessage() . "\n";
  17. }
  18. ?>
  19. --EXPECT--
  20. Array sizes are inconsistent