diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php
index fd11eb3..e8b4aa0 100644
--- a/src/HTML5/Parser/Tokenizer.php
+++ b/src/HTML5/Parser/Tokenizer.php
@@ -131,7 +131,10 @@ protected function consumeData()
$tok = $this->scanner->next();
- if ('!' === $tok) {
+ if (false === $tok) {
+ // end of string
+ $this->parseError('Illegal tag opening');
+ } elseif ('!' === $tok) {
$this->markupDeclaration();
} elseif ('/' === $tok) {
$this->endTag();