Permalink
Browse files

Move viewVars assignment after callbacks.

Assigning the controller viewVars after callbacks
allows the controller callbacks to assign additional
viewVars, or manipulate existing ones.

Fixes #2335
  • Loading branch information...
1 parent 0670b96 commit 457dd73ed069125f4f8ff69fbb1c781f00592045 @markstory markstory committed Dec 3, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/Cake/View/Helper/CacheHelper.php
@@ -283,7 +283,7 @@ protected function _writeFile($content, $timestamp, $useCallbacks = false) {
$controller->helpers = $this->helpers = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->helpers)) . '\'));
$controller->layout = $this->layout = \'' . $this->_View->layout. '\';
$controller->theme = $this->theme = \'' . $this->_View->theme . '\';
- $controller->viewVars = $this->viewVars = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->viewVars)) . '\'));
+ $controller->viewVars = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->viewVars)) . '\'));
Router::setRequestInfo($controller->request);
$this->request = $request;';
@@ -294,6 +294,7 @@ protected function _writeFile($content, $timestamp, $useCallbacks = false) {
}
$file .= '
+ $this->viewVars = $controller->viewVars;
$this->loadHelpers();
extract($this->viewVars, EXTR_SKIP);
?>';

0 comments on commit 457dd73

Please sign in to comment.