mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix issue with link generation and no title.
Fix urlencoded text from being displayed in text of links. Fixes #2387
This commit is contained in:
parent
ab2cf59b3d
commit
866177f37d
2 changed files with 13 additions and 1 deletions
|
@ -185,12 +185,24 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testLink() {
|
||||
Router::connect('/:controller/:action/*');
|
||||
|
||||
$this->Html->request->webroot = '';
|
||||
|
||||
$result = $this->Html->link('/home');
|
||||
$expected = array('a' => array('href' => '/home'), 'preg:/\/home/', '/a');
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Html->link(array('action' => 'login', '<[You]>'));
|
||||
$expected = array(
|
||||
'a' => array('href' => '/login/%3C%5BYou%5D%3E'),
|
||||
'preg:/\/login\/<\[You\]>/',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
Router::reload();
|
||||
|
||||
$result = $this->Html->link('Posts', array('controller' => 'posts', 'action' => 'index', 'full_base' => true));
|
||||
$expected = array('a' => array('href' => FULL_BASE_URL . '/posts'), 'Posts', '/a');
|
||||
$this->assertTags($result, $expected);
|
||||
|
|
|
@ -327,7 +327,7 @@ class HtmlHelper extends AppHelper {
|
|||
$url = $this->url($url);
|
||||
} else {
|
||||
$url = $this->url($title);
|
||||
$title = $url;
|
||||
$title = h(urldecode($url));
|
||||
$escapeTitle = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue