php-html-parser
php-html-parser copied to clipboard
Weird Comment Issue
So the parse seems to be having problems with this comment.
<!--[if (gte IE 6)&(lte IE 8)]><script src="https://www.random.test.js" />
</script><![endif]-->
After parse it looks like this
<!--[if (gte IE 6)&(lte IE 8)]--><script src="https://www.random.test.js"><![endif]-->
On a related matter, using v2.2.1, parsing the following comment <!-- Disable auto-scale in iOS 10 Mail entirely -->
fails when calling $innerHtml()
with TypeError PHPHtmlParser\Dom\Tag::getAttribute(): Argument #1 ($key) must be of type string, int given, called in /opt/project/vendor/paquettg/php-html-parser/src/PHPHtmlParser/Dom/Tag.php on line 336
.
The comment is parsed as such:
array:8 [ // vendor/paquettg/php-html-parser/src/PHPHtmlParser/Dom/Tag.php:336
0 => "disable"
1 => "auto-scale"
2 => "in"
3 => "ios"
4 => 10
5 => "mail"
6 => "entirely"
7 => "--"
]
In the linked commit, there has been a specific test for comments with number that was removed.
Relates to https://github.com/paquettg/php-html-parser/issues/247
UPD
Upgrading to ^3.1
, solves the issue.