diff --git a/src/voku/helper/HtmlDomParser.php b/src/voku/helper/HtmlDomParser.php index 0e6cf42..a9355d5 100644 --- a/src/voku/helper/HtmlDomParser.php +++ b/src/voku/helper/HtmlDomParser.php @@ -313,16 +313,14 @@ private function createDOMDocument($html, $libXMLExtraOptions = null) libxml_clear_errors(); $optionsSimpleXml = LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_NONET; - $optionsXml = LIBXML_DTDATTR | LIBXML_NONET; + $optionsXml = 0; if (defined('LIBXML_BIGLINES')) { $optionsSimpleXml |= LIBXML_BIGLINES; - $optionsXml |= LIBXML_BIGLINES; } if (defined('LIBXML_COMPACT')) { $optionsSimpleXml |= LIBXML_COMPACT; - $optionsXml |= LIBXML_COMPACT; } if (defined('LIBXML_HTML_NOIMPLIED')) { @@ -353,7 +351,7 @@ private function createDOMDocument($html, $libXMLExtraOptions = null) $html = self::replaceToPreserveHtmlEntities($html); - if (Bootup::is_php('5.4')) { + if ($optionsXml && Bootup::is_php('5.4')) { $this->document->loadHTML($html, $optionsXml); } else { $this->document->loadHTML($html); diff --git a/tests/HtmlDomParserTest.php b/tests/HtmlDomParserTest.php index bd344d0..c6291a8 100644 --- a/tests/HtmlDomParserTest.php +++ b/tests/HtmlDomParserTest.php @@ -221,19 +221,10 @@ public function findTests() array($html, 'input[id=in]', 1), array($html, '#in', 1), array($html, '*[id]', 52), + array($html, 'text', 462), array($html, 'comment', 3), ); - if (Bootup::is_php('5.4')) { - $tests = array_merge_recursive($tests, array( - array($html, 'text', 640), - )); - } else { - $tests = array_merge_recursive($tests, array( - array($html, 'text', 462), - )); - } - return $tests; } @@ -360,17 +351,10 @@ public function testMail2() $htmlExpected = str_replace(array("\r\n", "\r", "\n"), "\n", file_get_contents($filenameExpected)); // object to sting - if (Bootup::is_php('5.4')) { - self::assertSame( - $htmlExpected, - str_replace(array("\r\n", "\r", "\n"), "\n", (string)$html) - ); - } else { - self::assertSame( - str_replace(array("\r\n", "\r", "\n", " "), "", $htmlExpected), - str_replace(array("\r\n", "\r", "\n", " "), "", (string)$html) - ); - } + self::assertSame( + $htmlExpected, + str_replace(array("\r\n", "\r", "\n"), "\n", (string)$html) + ); $preHeaderContentArray = $html->find('.preheaderContent'); diff --git a/tests/SimpleHtmlDomNodeTest.php b/tests/SimpleHtmlDomNodeTest.php index a330576..d659e23 100644 --- a/tests/SimpleHtmlDomNodeTest.php +++ b/tests/SimpleHtmlDomNodeTest.php @@ -62,19 +62,10 @@ public function findTests() array($html, 'input[id]', 23), array($html, 'input[id=in]', 1), array($html, '#in', 1), + array($html, 'text', 390), array($html, '*[id]', 51), ); - if (Bootup::is_php('5.4')) { - $tests = array_merge_recursive($tests, array( - array($html, 'text', 539), - )); - } else { - $tests = array_merge_recursive($tests, array( - array($html, 'text', 390), - )); - } - return $tests; } diff --git a/tests/SimpleHtmlDomTest.php b/tests/SimpleHtmlDomTest.php index 67468a9..500019e 100644 --- a/tests/SimpleHtmlDomTest.php +++ b/tests/SimpleHtmlDomTest.php @@ -137,19 +137,10 @@ public function findTests() array($html, 'input[id=in]', 1), array($html, '#in', 1), array($html, '*[id]', 52), + array($html, 'text', 462), array($html, 'comment', 3), ); - if (Bootup::is_php('5.4')) { - $tests = array_merge_recursive($tests, array( - array($html, 'text', 640), - )); - } else { - $tests = array_merge_recursive($tests, array( - array($html, 'text', 462), - )); - } - return $tests; } diff --git a/tests/fixtures/test_mail_expected.html b/tests/fixtures/test_mail_expected.html index 3be2608..fdd9dcc 100644 --- a/tests/fixtures/test_mail_expected.html +++ b/tests/fixtures/test_mail_expected.html @@ -1,9 +1,9 @@ - - *|MC:SUBJECT|* -