diff options
author | Technosophos <[email protected]> | 2013-04-10 17:26:15 -0500 |
---|---|---|
committer | Technosophos <[email protected]> | 2013-04-10 17:26:15 -0500 |
commit | 759ed42c4436ea256add2bd675a1d18028ace0c7 (patch) | |
tree | b4d655125689981b6811baf68023107809695e2d /src/HTML5/Parser | |
parent | c6abe3417cf9adeeeeb17319081486109581378a (diff) |
Finishing tests on entities.
Diffstat (limited to 'src/HTML5/Parser')
-rw-r--r-- | src/HTML5/Parser/CharacterReference.php | 5 | ||||
-rw-r--r-- | src/HTML5/Parser/Tokenizer.php | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/HTML5/Parser/CharacterReference.php b/src/HTML5/Parser/CharacterReference.php index cc71f8f..ea6a527 100644 --- a/src/HTML5/Parser/CharacterReference.php +++ b/src/HTML5/Parser/CharacterReference.php @@ -19,9 +19,8 @@ class CharacterReference { * The character sequence. In UTF-8 this may be more than one byte. */ public static function lookupName($name) { - $char = Entities::$byName[$name]; - - return $char; + // Do we really want to return NULL here? or FFFD + return isset(Entities::$byName[$name]) ? Entities::$byName[$name] : NULL; } /** diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php index 2e74c5f..500588c 100644 --- a/src/HTML5/Parser/Tokenizer.php +++ b/src/HTML5/Parser/Tokenizer.php @@ -144,9 +144,10 @@ class Tokenizer { // X[0-9a-fA-F]+; // x[0-9a-fA-F]+; if ($tok == 'x' || $tok == 'X') { + $tok = $this->scanner->next(); // Consume x $hex = $this->scanner->getHex(); if (empty($hex)) { - throw ParseError("Expected &#xHEX;, got &#x" . $tok); + throw new ParseError("Expected &#xHEX;, got &#x" . $tok); } $entity = CharacterReference::lookupHex($hex); } |