Skip to content

Commit 5c7fe62

Browse files
committed
Issue paquettg#115 fixed and test added
1 parent 50a909a commit 5c7fe62

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/PHPHtmlParser/Dom.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ protected function parseTag(): array
748748
}
749749

750750
$this->content->skipByToken('blank');
751+
$tag = strtolower($tag);
751752
if ($this->content->char() == '/') {
752753
// self closing tag
753754
$node->getTag()->selfClosing();

src/PHPHtmlParser/Dom/HtmlNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ protected function clear(): void
201201
$this->text = null;
202202
$this->textWithChildren = null;
203203

204-
if (is_null($this->parent) === false) {
204+
if (!is_null($this->parent)) {
205205
$this->parent->clear();
206206
}
207207
}

tests/Options/StrictTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,14 @@ public function testConfigStrictMissingAttribute()
5353
$this->assertEquals("Tag 'p' has an attribute 'block' with out a value! (character #22)", $e->getMessage());
5454
}
5555
}
56+
57+
public function testConfigStrictBRTag()
58+
{
59+
$dom = new Dom;
60+
$dom->setOptions([
61+
'strict' => true,
62+
]);
63+
$dom->load('<br />');
64+
$this->assertTrue(true);
65+
}
5666
}

0 commit comments

Comments
 (0)