• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
anchor() unable to parse double quotes

#1
[eluser]Armchair Samurai[/eluser]
Pretty minor, but has come up a few times in the forum, mostly from people wanting to use the anchor() fuction with an image.

The anchor() function is unable to parse double quotes in the text parameter, causing corrupted HTML output, unless the third parameter is present to prevent the default rendering of the title attribute.

Example:
Code:
<?=anchor('path/goes/here', '"foo"');?>

/* Outputs an messy link */
<a href="http://docroot/path/goes/here" title=""foo"">"foo"</a>

One solution would be to parse the $attributes variable on line 111:
Code:
/* in the URL helper */
$attributes = str_replace('"', '&quot;', $title);

/* if you call the code from the first example,
it will parse everything correctly, outputting: */
<a href="http://docroot/path/goes/here" title="&quot;foo&quot;">"foo"</a>


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.