Ignore request values that are not strings.
An array action or username no longer causes a PHP error.
This commit is contained in:
@@ -72,6 +72,13 @@ class EditTest extends PageTestCase {
|
||||
$this->assertSame(array('5', 'Changed', 'Needs work'), array($row['id'], $row['title'], $row['comments']));
|
||||
}
|
||||
|
||||
public function testAnArrayActionIsIgnored(): void {
|
||||
$this->loginAs();
|
||||
$page = $this->post('/publish/edit', array('action' => array('delete'), 'id' => '1'));
|
||||
$this->assertSame(200, $page['status']);
|
||||
$this->assertSame(array(), $this->queries('/^(DELETE|INSERT|UPDATE)/'));
|
||||
}
|
||||
|
||||
public function testDeletingNeedsTheToken(): void {
|
||||
$page = $this->post('/publish/edit', array('action' => 'delete', 'id' => '1', 'queue' => '0', 'csrf_token' => 'wrong'));
|
||||
$this->assertStringContainsString('Your session has expired.', $page['body']);
|
||||
|
||||
Reference in New Issue
Block a user