Ignore request values that are not strings.
An array action or username no longer causes a PHP error.
This commit is contained in:
@@ -39,6 +39,14 @@ class LoginTest extends PageTestCase {
|
||||
$this->get('/publish/login', array('X-Test-Plain' => '1', 'Host' => 'evil.example')));
|
||||
}
|
||||
|
||||
public function testAnArrayUsernameIsRefused(): void {
|
||||
$token = $this->csrfToken($this->get('/publish/login')['body']);
|
||||
$answer = $this->post('/publish/login', array('login' => '1', 'username' => array('ed'), 'password' => 'secret',
|
||||
'csrf_token' => $token, 'g-recaptcha-response' => 'pass'));
|
||||
$this->assertSame(200, $answer['status']);
|
||||
$this->assertStringContainsString('Access denied.', $answer['body']);
|
||||
}
|
||||
|
||||
public function testTheFormHasATokenAndTheCaptcha(): void {
|
||||
$body = $this->get('/publish/login')['body'];
|
||||
$this->assertSame($this->session()['csrf_token'], $this->csrfToken($body));
|
||||
|
||||
Reference in New Issue
Block a user