mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
fixes reset FormHelper::$_unlockFields
This commit is contained in:
parent
78cda8c25d
commit
850305a384
2 changed files with 21 additions and 0 deletions
|
@ -1597,6 +1597,26 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertEquals(array(), $this->Form->fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* test reset unlockFields, when create new form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testResetUnlockFields() {
|
||||
$this->Form->request['_Token'] = array(
|
||||
'key' => 'testKey',
|
||||
'unlockedFields' => array()
|
||||
);
|
||||
|
||||
$this->Form->create('Contact');
|
||||
$this->Form->unlockField('Contact.id');
|
||||
$this->Form->end();
|
||||
|
||||
$this->Form->create('Contact');
|
||||
$this->Form->hidden('Contact.id', array('value' => 1));
|
||||
$this->assertEquals(1, $this->Form->fields['Contact.id'], 'Hidden input should be secured.');
|
||||
}
|
||||
|
||||
/**
|
||||
* testTagIsInvalid method
|
||||
*
|
||||
|
|
|
@ -466,6 +466,7 @@ class FormHelper extends AppHelper {
|
|||
$htmlAttributes = array_merge($options, $htmlAttributes);
|
||||
|
||||
$this->fields = array();
|
||||
$this->_unlockedFields = array();
|
||||
if ($this->requestType !== 'get') {
|
||||
$append .= $this->_csrfField();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue