Просмотр исходного кода

Specific HTML load for lib_phpQuery.php (#4243)

And reverts a less appropriate workaround for the same thing in https://github.com/FreshRSS/FreshRSS/pull/4220
Avoids XML errors when believing that a document might be XML/XHTML.
Alexandre Alapetite 4 лет назад
Родитель
Сommit
467ca9d0de
2 измененных файлов с 2 добавлено и 3 удалено
  1. 1 1
      app/Models/Entry.php
  2. 1 2
      lib/lib_phpQuery.php

+ 1 - 1
app/Models/Entry.php

@@ -484,7 +484,7 @@ class FreshRSS_Entry extends Minz_Model {
 			/**
 			 * @var phpQueryObject @doc
 			 */
-			$doc = phpQuery::newDocument($html);
+			$doc = phpQuery::newDocumentHTML($html);
 
 			if ($maxRedirs > 0) {
 				//Follow any HTML redirection

+ 1 - 2
lib/lib_phpQuery.php

@@ -436,8 +436,7 @@ class DOMDocumentWrapper {
 	}
 	protected function isXML($markup) {
 //		return strpos($markup, '<?xml') !== false && stripos($markup, 'xhtml') === false;
-		$head = substr($markup, 0, 100);
-		return strpos($head, '<'.'?xml') !== false && stripos($head, '<html ') === false;
+		return strpos(substr($markup, 0, 100), '<'.'?xml') !== false;
 	}
 	protected function contentTypeToArray($contentType) {
 		$matches = explode(';', trim(strtolower($contentType)));