xref: /php-src/ext/standard/tests/array/bug77395.phpt (revision f8d79582)
1--TEST--
2Bug #77395 (segfault about array_multisort)
3--FILE--
4<?php
5function 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}
11set_error_handler('error_handle');
12$data = [['aa'=> 'bb',], ['aa'=> 'bb',],];
13
14try {
15    array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error
16} catch (\ValueError $e) {
17    echo $e->getMessage() . "\n";
18}
19?>
20--EXPECT--
21Array sizes are inconsistent
22