Navigation Menu

Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #31 from vrana/master
Browse files Browse the repository at this point in the history
Invalid escaping in renderBaseAttrs
  • Loading branch information
scottmac committed Feb 15, 2012
2 parents 0ff0c6d + 0a99f67 commit 17f05e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion php-lib/html.php
Expand Up @@ -65,7 +65,7 @@ protected final function renderBaseAttrs() {
$buf = '<'.$this->tagName;
foreach ($this->getAttributes() as $key => $val) {
if ($val !== null && $val !== false) {
$buf .= ' ' . htmlspecialchars($key) . '="' . htmlspecialchars($val, true) . '"';
$buf .= ' ' . htmlspecialchars($key) . '="' . htmlspecialchars($val) . '"';
}
}
return $buf;
Expand Down
9 changes: 9 additions & 0 deletions tests/attr-quotes.phpt
@@ -0,0 +1,9 @@
--TEST--
Quotes in attribute
--FILE--
<?php
class xhp_a {}
$quote = '"';
echo <a b={$quote}>c</a>;
--EXPECT--
<a b="&quot;">c</a>

0 comments on commit 17f05e1

Please sign in to comment.