Permalink
Browse files

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
  • Loading branch information...
1 parent de1d1ae commit b94a85e938af862d2354dec6e03810c2ad3ba685 @markstory markstory committed Jan 14, 2009
Showing with 11 additions and 1 deletion.
  1. +1 −1 cake/libs/view/helper.php
  2. +10 −0 cake/tests/cases/libs/view/helpers/html.test.php
View
2 cake/libs/view/helper.php
@@ -175,7 +175,7 @@ function loadConfig($name = 'tags') {
* @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
View
10 cake/tests/cases/libs/view/helpers/html.test.php
@@ -148,6 +148,16 @@ function testLink() {
'/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);

0 comments on commit b94a85e

Please sign in to comment.