Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
3 changed files
with
23 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--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=== |