mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #8880 from nojimage/form-unlockfields-2x
Reset FormHelper::$_unlockFields for 2.x
This commit is contained in:
commit
b15560ea0c
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
|
||||
*
|
||||
|
|
|
@ -467,6 +467,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