1--TEST--
2usort() in combination with "Call to a member function method() on null"
3--FILE--
4<?php
5set_error_handler(function($code, $message) {
6  var_dump($code, $message);
7});
8
9$comparator= null;
10$list= [1, 4, 2, 3, -1];
11usort($list, function($a, $b) use ($comparator) {
12  try {
13      return $comparator->compare($a, $b);
14  } catch (Error $e) {
15      var_dump($e->getCode(), $e->getMessage());
16      return 0;
17  }
18});
19var_dump($list);
20echo "Alive\n";
21?>
22--EXPECT--
23int(0)
24string(43) "Call to a member function compare() on null"
25int(0)
26string(43) "Call to a member function compare() on null"
27int(0)
28string(43) "Call to a member function compare() on null"
29int(0)
30string(43) "Call to a member function compare() on null"
31array(5) {
32  [0]=>
33  int(1)
34  [1]=>
35  int(4)
36  [2]=>
37  int(2)
38  [3]=>
39  int(3)
40  [4]=>
41  int(-1)
42}
43Alive
44