Permalink
Browse files

Minor optimization in cache views.

  • Loading branch information...
1 parent a7c7436 commit 5d2b4c758dd2de4ac470e25416f35bcb9a3c16cb @jrbasso jrbasso committed Dec 18, 2010
Showing with 6 additions and 6 deletions.
  1. +5 −5 cake/libs/view/helpers/cache.php
  2. +1 −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 = unserialize(\'' . serialize($this->helpers) . '\');
+ $controller->helpers = $this->helpers = ' . var_export($this->helpers, true) . ';
$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 = 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(stripslashes(\'' . addslashes(serialize($this->viewVars)) . '\'));
+ $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->theme = $this->theme = \'' . $this->theme . '\';
Router::setRequestInfo(array($this->params, array(\'base\' => $this->base, \'webroot\' => $this->webroot)));';
@@ -336,7 +336,7 @@ function testCacheViewVars() {
$this->assertTrue(file_exists($filename));
$contents = file_get_contents($filename);
- $this->assertPattern('/\$this\-\>viewVars.*variable/', $contents);
+ $this->assertPattern('/\$this\-\>viewVars/', $contents);
$this->assertPattern('/extract\(\$this\-\>viewVars, EXTR_SKIP\);/', $contents);
$this->assertPattern('/php echo \$variable/', $contents);
$this->assertPattern('/variableValue/', $contents);

0 comments on commit 5d2b4c7

Please sign in to comment.