Commit 7382a68a authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes #11666 - Second try.

parent b15ace9f
Pipeline #4339 failed with stages
in 3 minutes and 31 seconds
......@@ -7,7 +7,6 @@
*/
namespace IMATHUZH\Qfq\Core\Helper;
/**
......@@ -289,14 +288,19 @@ class Sanitize {
*/
public static function digitCheckAndCleanGet($key) {
if (isset($_GET[$key]) && !ctype_digit($_GET[$key])) {
if (!empty($_GET[$key]) && is_array($_GET[$key]) && ctype_digit($_GET[$key][0])) {
$_GET[$key] = $_GET[$key][0];
} else {
$_GET[$key] = '';
}
if (!isset($_GET[$key])) {
$_GET[$key] = '';
return;
}
}
if (ctype_digit($_GET[$key])) {
return;
}
if (ctype_digit($_GET[$key][0] ?? '')) {
$_GET[$key] = $_GET[$key][0];
} else {
$_GET[$key] = '';
}
}
}
\ No newline at end of file
......@@ -349,7 +349,7 @@ class SanitizeTest extends TestCase {
unset ($_GET[CLIENT_PAGE_LANGUAGE]);
Sanitize::digitCheckAndCleanGet(CLIENT_PAGE_LANGUAGE);
$this->assertEquals(false, isset($_GET[CLIENT_PAGE_LANGUAGE]));
$this->assertEquals('', $_GET[CLIENT_PAGE_LANGUAGE]);
$_GET[CLIENT_PAGE_LANGUAGE] = '';
Sanitize::digitCheckAndCleanGet(CLIENT_PAGE_LANGUAGE);
......
Markdown is supported
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