Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
7382a68a
Commit
7382a68a
authored
Nov 30, 2020
by
Carsten Rose
Browse files
Fixes #11666 - Second try.
parent
b15ace9f
Pipeline
#4339
failed with stages
in 3 minutes and 31 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/Helper/Sanitize.php
View file @
7382a68a
...
...
@@ -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
extension/Tests/Unit/Core/Helper/SanitizeTest.php
View file @
7382a68a
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment