summaryrefslogtreecommitdiff
path: root/src/HTML5/Parser
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2015-03-08 13:39:01 -0400
committerMatt Farina <[email protected]>2015-03-08 13:39:01 -0400
commit63a502782449994fd59f108d6dd38adcae5db9d4 (patch)
treef883c6982ce9c91eeb82f3ef6ae85e4017686e04 /src/HTML5/Parser
parent8dce780fb24ff7178ead7fcf88146ed069cacb8b (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.php8
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 &amp; 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 '&';
}
}