Commit 20a8ab0a authored by crell's avatar crell Committed by Benni Mack
Browse files

[TASK] Shorten GeneralUtility::_GP() with PHP 7 syntax

Resolves: #93996
Releases: master
Change-Id: I1071d8aa69e92beb4ff8ee12e4c75535a11bb8af
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68886


Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent a0bcdc25
......@@ -118,13 +118,9 @@ class GeneralUtility
if (empty($var)) {
return;
}
if (isset($_POST[$var])) {
$value = $_POST[$var];
} elseif (isset($_GET[$var])) {
$value = $_GET[$var];
} else {
$value = null;
}
$value = $_POST[$var] ?? $_GET[$var] ?? null;
// This is there for backwards-compatibility, in order to avoid NULL
if (isset($value) && !is_array($value)) {
$value = (string)$value;
......
......@@ -152,7 +152,8 @@ class GeneralUtilityTest extends UnitTestCase
['cake' => ['is a' => 'l\\ie']],
[],
['is a' => 'l\\ie']
]
],
'Empty-ish key' => ['0', ['0' => 'zero'], ['0' => 'zero'], null],
];
}
......
Supports Markdown
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