mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
"Correcting Helper::setEntity() check if $parts[0] matches current model
Added tests for fix. Adding escaping of \\ in FileEngine::write();" git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6119 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
adcba2cc2d
commit
872dfbfcef
3 changed files with 15 additions and 2 deletions
2
cake/libs/cache/file.php
vendored
2
cake/libs/cache/file.php
vendored
|
@ -127,7 +127,7 @@ class FileEngine extends CacheEngine {
|
|||
$duration = $this->settings['duration'];
|
||||
}
|
||||
if (!empty($this->settings['serialize'])) {
|
||||
$data = serialize($data);
|
||||
$data = str_replace('\\', '\\\\', serialize($data));
|
||||
}
|
||||
|
||||
if ($this->settings['lock']) {
|
||||
|
|
|
@ -328,7 +328,7 @@ class Helper extends Overloadable {
|
|||
$sameScope = $hasField = false;
|
||||
$parts = preg_split('/\/|\./', $entity);
|
||||
|
||||
if($parts[0] !== $view->model || count($parts) == 1) {
|
||||
if($parts[0] === $view->model || count($parts) == 1) {
|
||||
$sameScope = true;
|
||||
if (ClassRegistry::isKeySet($view->model)) {
|
||||
$modelObj =& ClassRegistry::getObject($view->model);
|
||||
|
|
|
@ -1376,6 +1376,19 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertEqual($result, '<div class="good"><input type="submit" name="Whatever" value="save" /></div></form>');
|
||||
}
|
||||
|
||||
function testMultipleFormWithIdFields() {
|
||||
$this->Form->create('UserForm');
|
||||
|
||||
$result = $this->Form->input('id');
|
||||
$this->assertEqual($result, '<input type="hidden" name="data[UserForm][id]" value="" id="UserFormId" />');
|
||||
|
||||
$result = $this->Form->input('My.id');
|
||||
$this->assertEqual($result, '<input type="hidden" name="data[My][id]" value="" id="MyId" />');
|
||||
|
||||
$result = $this->Form->input('MyOther.id');
|
||||
$this->assertEqual($result, '<input type="hidden" name="data[MyOther][id]" value="" id="MyOtherId" />');
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
ClassRegistry::removeObject('view');
|
||||
ClassRegistry::removeObject('Contact');
|
||||
|
|
Loading…
Reference in a new issue