Skip to content
Permalink
Browse files

Adding a line to the generated cache files,

that re-assigns view params after component callbacks.
Fixes issues with SecurityComponent and cache files.
Fixes #1863
  • Loading branch information...
markstory committed Aug 6, 2011
1 parent ea7c8c4 commit 6ef4ce4c31b2d77a2b4e048d025e39b24f695b1f
Showing with 34 additions and 1 deletion.
  1. +2 −1 cake/libs/view/helpers/cache.php
  2. +32 −0 cake/tests/cases/libs/view/helpers/cache.test.php
@@ -277,7 +277,8 @@ function __writeFile($content, $timestamp, $useCallbacks = false) {
$controller->constructClasses();
$controller->Component->initialize($controller);
$controller->beforeFilter();
$controller->Component->startup($controller);';
$controller->Component->startup($controller);
$this->params = $controller->params;';
}
$file .= '
@@ -342,6 +342,38 @@ function testCacheViewVars() {
@unlink($filename);
}
function testCacheCallbacks() {
$this->Controller->cache_parsing();
$this->Controller->params = array(
'controller' => 'cache_test',
'action' => 'cache_parsing',
'url' => array(),
'pass' => array(),
'named' => array()
);
$this->Controller->cacheAction = array(
'cache_parsing' => array(
'duration' => 21600,
'callbacks' => true
)
);
$this->Controller->here = '/cacheTest/cache_parsing';
$this->Controller->action = 'cache_parsing';
$View = new View($this->Controller);
$result = $View->render('index');
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
$this->assertTrue(file_exists($filename));
$contents = file_get_contents($filename);
$this->assertPattern('/\$controller->beforeFilter\(\);/', $contents);
$this->assertPattern('/\$this->params = \$controller->params;/', $contents);
@unlink($filename);
}
/**
* test cacheAction set to a boolean

0 comments on commit 6ef4ce4

Please sign in to comment.
You can’t perform that action at this time.