mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Allow plus signs in URL's to pass unscathed in Helper functions.
According to RFC 1738 the plus sign does not have special meaning outisde of the query part of a URL.
This commit is contained in:
parent
be63a5d59f
commit
cfdac5e32d
2 changed files with 6 additions and 2 deletions
|
@ -660,6 +660,9 @@ class HelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Helper->assetUrl('foo.jpg?one=two&three=four');
|
||||
$this->assertEquals('foo.jpg?one=two&three=four', $result);
|
||||
|
||||
$result = $this->Helper->assetUrl('dir/big+tall/image', array('ext' => '.jpg'));
|
||||
$this->assertEquals('dir/big%2Btall/image.jpg', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -674,7 +677,8 @@ class HelperTest extends CakeTestCase {
|
|||
'here' => '/cake_dev/index.php/tasks',
|
||||
));
|
||||
$result = $this->Helper->assetUrl('img/cake.icon.png', array('fullBase' => true));
|
||||
$this->assertEquals('http://localhost/cake_dev/app/webroot/img/cake.icon.png', $result);
|
||||
|
||||
$this->assertEquals($result, 'http://' . $_SERVER['HTTP_HOST'] . '/cake_dev/app/webroot/img/cake.icon.png');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -341,7 +341,7 @@ class Helper extends Object {
|
|||
*/
|
||||
protected function _encodeUrl($url) {
|
||||
$path = parse_url($url, PHP_URL_PATH);
|
||||
$parts = array_map('urldecode', explode('/', $path));
|
||||
$parts = array_map('rawurldecode', explode('/', $path));
|
||||
$parts = array_map('rawurlencode', $parts);
|
||||
$encoded = implode('/', $parts);
|
||||
return h(str_replace($path, $encoded, $url));
|
||||
|
|
Loading…
Reference in a new issue