Permalink
Browse files

Fixed wrong viewVars store when have objects in view caching. Fixes #…

  • Loading branch information...
1 parent 5464ed8 commit bbf6aedd9cb520ada416b9eeedc090e461ce32bc @jrbasso jrbasso committed Jan 28, 2011
Showing with 5 additions and 6 deletions.
  1. +5 −5 cake/libs/view/helpers/cache.php
  2. +0 −1 cake/tests/cases/libs/view/helpers/cache.test.php
@@ -225,15 +225,15 @@ function __writeFile($content, $timestamp, $useCallbacks = false) {
$file .= '$controller =& new ' . $this->controllerName . 'Controller();
$controller->plugin = $this->plugin = \''.$this->plugin.'\';
- $controller->helpers = $this->helpers = ' . var_export($this->helpers, true) . ';
+ $controller->helpers = $this->helpers = unserialize(\'' . serialize($this->helpers) . '\');
$controller->base = $this->base = \'' . $this->base . '\';
$controller->layout = $this->layout = \'' . $this->layout. '\';
$controller->webroot = $this->webroot = \'' . $this->webroot . '\';
$controller->here = $this->here = \'' . $this->here . '\';
- $controller->params = $this->params = ' . var_export($this->params, true) . ';
- $controller->action = $this->action = ' . var_export($this->action, true) . ';
- $controller->data = $this->data = ' . var_export($this->data, true) . ';
- $controller->viewVars = $this->viewVars = ' . var_export($this->viewVars, true) . ';
+ $controller->params = $this->params = unserialize(stripslashes(\'' . addslashes(serialize($this->params)) . '\'));
+ $controller->action = $this->action = unserialize(\'' . serialize($this->action) . '\');
+ $controller->data = $this->data = unserialize(stripslashes(\'' . addslashes(serialize($this->data)) . '\'));
+ $controller->viewVars = $this->viewVars = unserialize(base64_decode(\'' . base64_encode(serialize($this->viewVars)) . '\'));
$controller->theme = $this->theme = \'' . $this->theme . '\';
Router::setRequestInfo(array($this->params, array(\'base\' => $this->base, \'webroot\' => $this->webroot)));';
@@ -339,7 +339,6 @@ function testCacheViewVars() {
$this->assertPattern('/\$this\-\>viewVars/', $contents);
$this->assertPattern('/extract\(\$this\-\>viewVars, EXTR_SKIP\);/', $contents);
$this->assertPattern('/php echo \$variable/', $contents);
- $this->assertPattern('/variableValue/', $contents);
@unlink($filename);
}

0 comments on commit bbf6aed

Please sign in to comment.