mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-10 05:22:41 +00:00
Fix blackhole requests with empty select boxes.
When a select box was entirely empty (no option element) secured form submission should not fail. Fixes #3153
This commit is contained in:
parent
b68a2ed84d
commit
cbb64bd082
2 changed files with 31 additions and 2 deletions
|
@ -4256,6 +4256,30 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertRegExp('/"' . $key . '"/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* When a select box has no options it should not be added to the fields list
|
||||
* as it always fail post validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSelectNoSecureWithNoOptions() {
|
||||
$this->Form->request['_Token'] = array('key' => 'testkey');
|
||||
$this->assertEquals(array(), $this->Form->fields);
|
||||
|
||||
$this->Form->select(
|
||||
'Model.select',
|
||||
array()
|
||||
);
|
||||
$this->assertEquals(array(), $this->Form->fields);
|
||||
|
||||
$this->Form->select(
|
||||
'Model.select',
|
||||
array(),
|
||||
array('empty' => true)
|
||||
);
|
||||
$this->assertEquals(array('Model.select'), $this->Form->fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* testInputMultipleCheckboxes method
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue