From b94a85e938af862d2354dec6e03810c2ad3ba685 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 14 Jan 2009 22:41:47 +0000 Subject: [PATCH] Altering Helper::url() to enforce escaped query strings for generated urls. Tests added to Html::link(). Fixes #5982 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7991 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/helper.php | 2 +- cake/tests/cases/libs/view/helpers/html.test.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index 9919b358a..1c4786646 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -175,7 +175,7 @@ class Helper extends Overloadable { * @return string Full translated URL with base path. */ function url($url = null, $full = false) { - return Router::url($url, $full); + return Router::url($url, array('full' => $full, 'escape' => true)); } /** * Checks if a file exists when theme is used, if no file is found default location is returned diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php index 46e2c7db9..5aa858708 100644 --- a/cake/tests/cases/libs/view/helpers/html.test.php +++ b/cake/tests/cases/libs/view/helpers/html.test.php @@ -148,6 +148,16 @@ class HtmlHelperTest extends CakeTestCase { '/a' ); $this->assertTags($result, $expected); + + $result = $this->Html->link('Original size', array( + 'controller' => 'images', 'action' => 'view', 3, '?' => array('height' => 100, 'width' => 200) + )); + $expected = array( + 'a' => array('href' => '/images/view/3?height=100&width=200'), + 'Original size', + '/a' + ); + $this->assertTags($result, $expected); Configure::write('Asset.timestamp', false);