php-src/ext/standard/tests/gh13279.phpt
Ilija Tovilo d65c395049
Fix instable array during in-place modification in uksort
The array isn't just observable if the array has RCn, but also if it is inside a
reference that is RCn. By-ref parameters are always RCn and as such always
observable.

Fixes GH-13279
Closes GH-13285
2024-01-31 19:25:30 +01:00

19 lines
299 B
PHP

--TEST--
GH-13279: Instable array during in-place modification in uksort
--FILE--
<?php
// Make sure the array is not const
$array = [];
$array['a'] = 1;
$array['b'] = 2;
uksort($array, function ($a, $b) use (&$array) {
return $array[$a] - $array[$b];
});
?>
===DONE===
--EXPECT--
===DONE===