Skip to content
Snippets Groups Projects
Commit e9c21b8d authored by Christian Kuhn's avatar Christian Kuhn Committed by Wouter Wolters
Browse files

[BUGFIX] Warnings in ArrayUtility with some PHP versions

PHP issue https://bugs.php.net/bug.php?id=50688 triggers a warning
in ArrayUtility::sortArraysByKey() on some supported PHP versions
like debian wheezy 5.4.4. Since this is a language error and the
code itself is correct and covered by unit tests, the warning is
now suppressed using the @ operator.

Change-Id: Ie169774d8659e55542f0c831078c00958de257c9
Resolves: #56889
Relases: 6.2
Reviewed-on: https://review.typo3.org/28359
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
parent b46e6a8e
Branches
Tags
No related merge requests found
......@@ -284,7 +284,12 @@ class ArrayUtility {
if (empty($arrays)) {
return $arrays;
}
$sortResult = uasort($arrays, function (array $a, array $b) use ($key, $ascending) {
// @ operator used: Some PHP versions like 5.4.4-14+deb7u8 (debian wheezy) are
// affected by PHP bug https://bugs.php.net/bug.php?id=50688 and trigger a warning.
// The code itself is ok and covered by unit tests, so the @ operator is used to
// suppress output of the PHP bug. This can be removed if the core does not
// support PHP version affected by this issue anymore.
$sortResult = @uasort($arrays, function (array $a, array $b) use ($key, $ascending) {
if (!isset($a[$key]) || !isset($b[$key])) {
throw new \RuntimeException('The specified sorting key "' . $key . '" is not available in the given array.', 1373727309);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment