Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/PHPHtmlParser/Dom/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
11 changes: 11 additions & 0 deletions tests/Node/TextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use PHPHtmlParser\Dom;
use PHPHtmlParser\Dom\Node\TextNode;
use PHPHtmlParser\Options;
use PHPUnit\Framework\TestCase;
use stringEncode\Encode;

Expand Down Expand Up @@ -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('<!-- test comment with number 2 -->');
$output = $dom->outerHtml;
$this->assertContains('<!-- test comment with number 2 -->', $output);
}
}