Skip to content

Commit

Permalink
Removing addslashes/stripslashes in cache file generation as they wer…
Browse files Browse the repository at this point in the history
…e creating corrupted serialized objects. Replacing with a simple str_replace() on ' instead.
  • Loading branch information
markstory committed May 2, 2010
1 parent 13cc8e7 commit 12cbf31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cake/libs/view/helpers/cache.php
Expand Up @@ -230,9 +230,9 @@ function __writeFile($content, $timestamp, $useCallbacks = false) {
$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->params = $this->params = unserialize(\'' . str_replace("'", "\\'", serialize($this->params)) . '\');
$controller->action = $this->action = unserialize(\'' . serialize($this->action) . '\');
$controller->data = $this->data = unserialize(stripslashes(\'' . addslashes(serialize($this->data)) . '\'));
$controller->data = $this->data = unserialize(\'' . str_replace("'", "\\'", serialize($this->data)) . '\');
$controller->theme = $this->theme = \'' . $this->theme . '\';
Router::setRequestInfo(array($this->params, array(\'base\' => $this->base, \'webroot\' => $this->webroot)));';

Expand Down
3 changes: 3 additions & 0 deletions cake/tests/cases/dispatcher.test.php
Expand Up @@ -1434,6 +1434,9 @@ public function testFullPageCachingDispatch() {
unlink($filename);

$url = 'test_cached_pages/index';
$_POST = array(
'slasher' => "Up in your's grill \ '"
);

ob_start();
$dispatcher->dispatch($url);
Expand Down

0 comments on commit 12cbf31

Please sign in to comment.