mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-04 02:22:39 +00:00
Fix FormHelper::create() dropping 0 value parameter.
When 0 is the first passed parameter we shouldn't drop it. Fixes #6107
This commit is contained in:
parent
af65067b50
commit
744952e344
2 changed files with 5 additions and 4 deletions
|
@ -8642,6 +8642,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
'escape' => false,
|
||||
'url' => array(
|
||||
'action' => 'edit',
|
||||
'0',
|
||||
'myparam'
|
||||
)
|
||||
));
|
||||
|
@ -8649,7 +8650,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
'form' => array(
|
||||
'id' => 'ContactAddForm',
|
||||
'method' => 'post',
|
||||
'action' => '/contacts/edit/myparam',
|
||||
'action' => '/contacts/edit/0/myparam',
|
||||
'accept-charset' => $encoding
|
||||
),
|
||||
'div' => array('style' => 'display:none;'),
|
||||
|
@ -8667,8 +8668,8 @@ class FormHelperTest extends CakeTestCase {
|
|||
public function testCreateNoErrorsWithMockModel() {
|
||||
$encoding = strtolower(Configure::read('App.encoding'));
|
||||
$ContactMock = $this->getMockBuilder('Contact')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
ClassRegistry::removeObject('Contact');
|
||||
ClassRegistry::addObject('Contact', $ContactMock);
|
||||
$result = $this->Form->create('Contact', array('type' => 'GET'));
|
||||
|
|
|
@ -408,7 +408,7 @@ class FormHelper extends AppHelper {
|
|||
'action' => $options['action'],
|
||||
);
|
||||
$options['action'] = array_merge($actionDefaults, (array)$options['url']);
|
||||
if (empty($options['action'][0]) && !empty($id)) {
|
||||
if (!isset($options['action'][0]) && !empty($id)) {
|
||||
$options['action'][0] = $id;
|
||||
}
|
||||
} elseif (is_string($options['url'])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue