Skip to content
GitLab
Menu
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
3923af69
Commit
3923af69
authored
May 05, 2019
by
Carsten Rose
Browse files
Refs #8278: Fixes unit tests
parent
6152f1c0
Pipeline
#1831
passed with stage
in 2 minutes and 17 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Source/core/store/Config.php
View file @
3923af69
...
...
@@ -223,6 +223,11 @@ class Config {
$maxLength
=
$config
[
SYSTEM_SECURITY_GET_MAX_LENGTH
];
if
(
$maxLength
>
0
&&
$attack
===
false
)
{
foreach
(
$_GET
as
$key
=>
$value
)
{
if
(
!
is_string
(
$value
))
{
continue
;
}
// Check if the variable is something like 'my_name_100' - if the part after the last '_' is numerical, this means a valid, non standard length.
$arr
=
explode
(
GET_EXTRA_LENGTH_TOKEN
,
$key
);
...
...
@@ -272,7 +277,9 @@ class Config {
$penalty
=
(
empty
(
$config
[
SYSTEM_SECURITY_ATTACK_DELAY
])
||
!
is_numeric
(
$config
[
SYSTEM_SECURITY_ATTACK_DELAY
]))
?
SYSTEM_SECURITY_ATTACK_DELAY_DEFAULT
:
$config
[
SYSTEM_SECURITY_ATTACK_DELAY
];
sleep
(
$penalty
);
if
(
!
defined
(
'PHPUNIT_QFQ'
))
{
sleep
(
$penalty
);
}
if
(
$config
[
SYSTEM_SECURITY_SHOW_MESSAGE
]
==
'true'
||
$config
[
SYSTEM_SECURITY_SHOW_MESSAGE
]
==
1
)
{
...
...
extension/Source/core/store/Session.php
View file @
3923af69
...
...
@@ -118,16 +118,17 @@ class Session
*/
public
static
function
destroy
()
{
if
(
isset
(
$_COOKIE
[
SESSION_NAME
]))
{
unset
(
$_COOKIE
[
SESSION_NAME
]);
setcookie
(
SESSION_NAME
,
''
,
time
()
-
86400
,
'/'
);
// empty value and old timestamp
}
if
(
!
defined
(
'PHPUNIT_QFQ'
))
{
if
(
isset
(
$_COOKIE
[
SESSION_NAME
]))
{
unset
(
$_COOKIE
[
SESSION_NAME
]);
setcookie
(
SESSION_NAME
,
''
,
time
()
-
86400
,
'/'
);
// empty value and old timestamp
}
session_destroy
();
}
$_SESSION
=
array
();
$_SESSION
=
array
();
}
/**
...
...
extension/Tests/unit/core/store/ConfigTest.php
View file @
3923af69
...
...
@@ -43,7 +43,6 @@ class ConfigTest extends TestCase {
$config
=
Config
::
setDefaults
(
array
());
// Check for customized length (below)
$_GET
=
array
();
# 60
$_GET
[
'fake_65'
]
=
'012345678901234567890123456789012345678901234567890123456789'
;
Config
::
checkForAttack
(
$config
);
...
...
@@ -62,9 +61,6 @@ class ConfigTest extends TestCase {
$config
=
Config
::
setDefaults
(
array
());
// Check for customized length (below)
$_GET
=
array
();
// Check for customized length (above)
# 80
$_GET
[
'fake_65'
]
=
'01234567890123456789012345678901234567890123456789012345678901234567890123456789'
;
...
...
@@ -87,4 +83,13 @@ class ConfigTest extends TestCase {
Config
::
checkForAttack
(
$config
);
}
protected
function
setUp
()
{
$_GET
=
array
();
$_POST
=
array
();
}
protected
function
tearDown
()
{
$_GET
=
array
();
$_POST
=
array
();
}
}
extension/Tests/unit/core/store/StoreTest.php
View file @
3923af69
...
...
@@ -32,6 +32,8 @@ class StoreTest extends TestCase {
*/
public
function
setUp
()
{
// Client Variables has to setup before the first instantiation of 'Store'
$_GET
[]
=
array
();
$_POST
[]
=
array
();
$_GET
[
CLIENT_RECORD_ID
]
=
'1234'
;
$_GET
[
'key01'
]
=
'1234'
;
$_POST
[
'key02'
]
=
'2345'
;
...
...
@@ -327,6 +329,9 @@ class StoreTest extends TestCase {
*/
public
function
testConfigIniDefaultValues
()
{
$_GET
[]
=
array
();
$_POST
[]
=
array
();
$expect
=
[
SYSTEM_DB_1_USER
=>
'<DBUSER>'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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