diff options
author | Matt Farina <[email protected]> | 2015-03-08 13:39:01 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2015-03-08 13:39:01 -0400 |
commit | 63a502782449994fd59f108d6dd38adcae5db9d4 (patch) | |
tree | f883c6982ce9c91eeb82f3ef6ae85e4017686e04 /src/HTML5/Parser | |
parent | 8dce780fb24ff7178ead7fcf88146ed069cacb8b (diff) |
Closes #78: Fixes bug where unmatched entity like string drops everything after &.
Diffstat (limited to 'src/HTML5/Parser')
-rw-r--r-- | src/HTML5/Parser/Tokenizer.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php index e00b9a2..a779191 100644 --- a/src/HTML5/Parser/Tokenizer.php +++ b/src/HTML5/Parser/Tokenizer.php @@ -1065,8 +1065,14 @@ class Tokenizer // [a-zA-Z0-9]+; $cname = $this->scanner->getAsciiAlpha(); $entity = CharacterReference::lookupName($cname); + + // When no entity is found provide the name of the unmatched string + // 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'", $entity); + $this->parseError("No match in entity table for '%s'", $cname); + $this->scanner->unconsume($this->scanner->position() - $start); + return '&'; } } |