#6071: HtmlHelper's escape option wrongly unset
--------------------------------------------+-------------------------------
Reporter: headache | Owner:
Type: Test Case | Status: new
Priority: Low | Milestone: 1.2.x.x
Component: Helpers | Version: 1.2 Final
Severity: Normal | Resolution:
Keywords: html,link,htmlhelper,escape | Php_version: n/a
Cake_version: 1.2.1.8004 |
--------------------------------------------+-------------------------------
Comment (by headache):
Sure, here's a bit more info.
The following should create a link with an unescaped title attribute
containing an ellipsis:
{{{
echo $html->link(
'click me',
array('controller' => 'users', 'action' => 'login'),
array('title' => 'to escape … or not escape?', 'escape' =>
false),
false, false
);
}}}
However, HtmlHelper::link() unsets the 'escape' option before passing
$htmlAttributes to _parseAttributes() so the title is not escaped.
I think that getting rid of the $escapeTitle param and moving things into
options that can be passed down to other methods, as it appears to me to
be the reasoning for checking the option in addition to $escapeTitle, is
laudable. Though, you must consider that the 'escape' option will then be
doing double duty for both the link text (awkwardly-named $title param)
and the link's attributes (eg. title, alt, etc.).
In any case, the fix is to remove this line:
{{{
unset($htmlAttributes['escape']);
}}}
so that _parseAttributes() will receive the escape option.
--
Ticket URL: <https://trac.cakephp.org/ticket/6071#comment:3>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---