diff --git a/src/PHPHtmlParser/Dom/Tag.php b/src/PHPHtmlParser/Dom/Tag.php
index 29b68bf..2aeb6aa 100644
--- a/src/PHPHtmlParser/Dom/Tag.php
+++ b/src/PHPHtmlParser/Dom/Tag.php
@@ -329,6 +329,8 @@ public function makeOpeningTag()
} catch (AttributeNotFoundException $e) {
// attribute that was in the array not found in the array... let's continue.
continue;
+ } catch (\TypeError $e) {
+ $val = null;
}
$val = $attributeDTO->getValue();
if (\is_null($val)) {
diff --git a/tests/Node/TextTest.php b/tests/Node/TextTest.php
index 44298fc..ce7f0f5 100755
--- a/tests/Node/TextTest.php
+++ b/tests/Node/TextTest.php
@@ -4,6 +4,7 @@
use PHPHtmlParser\Dom;
use PHPHtmlParser\Dom\Node\TextNode;
+use PHPHtmlParser\Options;
use PHPUnit\Framework\TestCase;
use stringEncode\Encode;
@@ -74,4 +75,14 @@ public function testSetTextEncoded()
$node->setText('biz baz');
$this->assertEquals('biz baz', $node->text());
}
+
+ public function testCommentWithNumbers() {
+ $dom = new Dom;
+ $options = new Options();
+ $options->setCleanupInput(false);
+ $dom->setOptions($options);
+ $dom->loadStr('');
+ $output = $dom->outerHtml;
+ $this->assertContains('', $output);
+ }
}