summaryrefslogtreecommitdiff
path: root/src/HTML5/Parser
diff options
context:
space:
mode:
authorTechnosophos <[email protected]>2013-04-10 17:26:15 -0500
committerTechnosophos <[email protected]>2013-04-10 17:26:15 -0500
commit759ed42c4436ea256add2bd675a1d18028ace0c7 (patch)
treeb4d655125689981b6811baf68023107809695e2d /src/HTML5/Parser
parentc6abe3417cf9adeeeeb17319081486109581378a (diff)
Finishing tests on entities.
Diffstat (limited to 'src/HTML5/Parser')
-rw-r--r--src/HTML5/Parser/CharacterReference.php5
-rw-r--r--src/HTML5/Parser/Tokenizer.php3
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);
}