From 4f6f041730177a1cd39555b06f962d3254a49c80 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Tue, 27 Mar 2012 00:57:15 -0430 Subject: [PATCH] Using same serialization strategy for request object in cached views, this prevents some failing tests in environments with different charsets --- lib/Cake/Test/Case/Routing/DispatcherTest.php | 2 +- lib/Cake/View/Helper/CacheHelper.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php index 00bd99b1b..8b277c706 100644 --- a/lib/Cake/Test/Case/Routing/DispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php @@ -1423,7 +1423,7 @@ class DispatcherTest extends CakeTestCase { $cached = preg_replace('//', '', $cached); - $this->assertTextEquals($cached, $out); + $this->assertTextEquals($out, $cached); $filename = $this->__cachePath($request->here()); unlink($filename); diff --git a/lib/Cake/View/Helper/CacheHelper.php b/lib/Cake/View/Helper/CacheHelper.php index a8636fe5a..d66f24d34 100644 --- a/lib/Cake/View/Helper/CacheHelper.php +++ b/lib/Cake/View/Helper/CacheHelper.php @@ -291,7 +291,7 @@ class CacheHelper extends AppHelper { } $file .= ' - $request = unserialize(\'' . str_replace("'", "\\'", serialize($this->request)) . '\'); + $request = unserialize(base64_decode(\'' . base64_encode(serialize($this->request)) . '\')); $response = new CakeResponse(array("charset" => Configure::read("App.encoding"))); $controller = new ' . $this->_View->name . 'Controller($request, $response); $controller->plugin = $this->plugin = \'' . $this->_View->plugin . '\';