diff options
author | Asmir Mustafic <[email protected]> | 2017-09-01 17:07:16 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-09-01 17:07:16 +0200 |
commit | 39e2a7a30757948389a7ca744653a9adcca06bcb (patch) | |
tree | 5d6247ec963b0664b2728d5a319b8026f692a798 /src/HTML5 | |
parent | b8afbae8cdb626c786a1590b3a83d366933d807d (diff) | |
parent | 2a38f56f3772f943be436c7b411c2ae5fac6cee6 (diff) |
Merge pull request #134 from Masterminds/ampersand-in-urls
Raw & in attributes
Diffstat (limited to 'src/HTML5')
-rw-r--r-- | src/HTML5/Parser/Tokenizer.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php index 95dbf84..c42bc3d 100644 --- a/src/HTML5/Parser/Tokenizer.php +++ b/src/HTML5/Parser/Tokenizer.php @@ -1074,8 +1074,10 @@ class Tokenizer } $entity = CharacterReference::lookupDecimal($numeric); } - } // String entity. - else { + } elseif ($tok === '=' && $inAttribute) { + return '&'; + } else { // String entity. + // Attempt to consume a string up to a ';'. // [a-zA-Z0-9]+; $cname = $this->scanner->getAsciiAlphaNum(); @@ -1085,7 +1087,9 @@ class Tokenizer // and continue on as the & is not part of an entity. The & will // be converted to & elsewhere. if ($entity == null) { - $this->parseError("No match in entity table for '%s'", $cname); + if (!$inAttribute || strlen($cname) === 0) { + $this->parseError("No match in entity table for '%s'", $cname); + } $this->scanner->unconsume($this->scanner->position() - $start); return '&'; } |