1--TEST--
2Crash when function parameter modified via reference while keeping orig refcount
3--FILE--
4<?php
5
6$array = array(
7    1 => "entry_1",
8    2 => "entry_2",
9    3 => "entry_3",
10    4 => "entry_4",
11    5 => "entry_5"
12);
13usort($array, function($a, $b) use (&$array, &$ref) {
14    unset($array[2]);
15    $ref = $array;
16    return $a <=> $b;
17});
18var_dump($array);
19
20?>
21--EXPECT--
22array(5) {
23  [0]=>
24  string(7) "entry_1"
25  [1]=>
26  string(7) "entry_2"
27  [2]=>
28  string(7) "entry_3"
29  [3]=>
30  string(7) "entry_4"
31  [4]=>
32  string(7) "entry_5"
33}
34