Selaa lähdekoodia

Manual update SimplePie (#4011)

* https://github.com/simplepie/simplepie/commit/417a1661b2610448bd8e1835d6d4160a0aff9a97
* https://github.com/simplepie/simplepie/commit/ebdd0643ee927edfcaf40bfd27ab23ce9c975120
* https://github.com/simplepie/simplepie/commit/941412027a46979b4f1d29e53edf91829788d781
* https://github.com/simplepie/simplepie/commit/f58a23730f01f26bbcfe02ff9266e337c241be88
Alexandre Alapetite 4 vuotta sitten
vanhempi
commit
b21fe199ed

+ 11 - 5
lib/SimplePie/SimplePie.php

@@ -2707,13 +2707,19 @@ class SimplePie
 			}
 		}
 
-		if (isset($this->data['headers']['link']) &&
-		    preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/',
-		               $this->data['headers']['link'], $match))
+		if (isset($this->data['headers']['link']))
 		{
-			return array($match[1]);
+			$link_headers = $this->data['headers']['link'];
+			if (is_string($link_headers)) {
+				$link_headers = array($link_headers);
+			}
+			$matches = preg_filter('/<([^>]+)>; rel='.preg_quote($rel).'/', '$1', $link_headers);
+			if (!empty($matches)) {
+				return $matches;
+			}
 		}
-		else if (isset($this->data['links'][$rel]))
+
+		if (isset($this->data['links'][$rel]))
 		{
 			return $this->data['links'][$rel];
 		}

+ 6 - 1
lib/SimplePie/SimplePie/Enclosure.php

@@ -1152,7 +1152,12 @@ class SimplePie_Enclosure
 		// If we encounter an unsupported mime-type, check the file extension and guess intelligently.
 		if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
 		{
-			switch (strtolower($this->get_extension()))
+			$extension = $this->get_extension();
+			if ($extension === null) {
+				return null;
+			}
+
+			switch (strtolower($extension))
 			{
 				// Audio mime-types
 				case 'aac':

+ 6 - 4
lib/SimplePie/SimplePie/HTTP/Parser.php

@@ -507,11 +507,13 @@ class SimplePie_HTTP_Parser
 	{
 		$data = explode("\r\n\r\n", $headers, $count);
 		$data = array_pop($data);
-		if (false !== stripos($data, "HTTP/1.0 200 Connection established\r\n\r\n")) {
-			$data = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $data);
+		if (false !== stripos($data, "HTTP/1.0 200 Connection established\r\n")) {
+			$exploded = explode("\r\n\r\n", $data, 2);
+			$data = end($exploded);
 		}
-		if (false !== stripos($data, "HTTP/1.1 200 Connection established\r\n\r\n")) {
-			$data = str_ireplace("HTTP/1.1 200 Connection established\r\n\r\n", '', $data);
+		if (false !== stripos($data, "HTTP/1.1 200 Connection established\r\n")) {
+			$exploded = explode("\r\n\r\n", $data, 2);
+			$data = end($exploded);
 		}
 		return $data;
 	}

+ 2 - 1
lib/SimplePie/SimplePie/Registry.php

@@ -208,7 +208,8 @@ class SimplePie_Registry
 			{
 				case 'Cache':
 					// For backwards compatibility with old non-static
-					// Cache::create() methods
+					// Cache::create() methods in PHP < 8.0.
+					// No longer supported as of PHP 8.0.
 					if ($method === 'get_handler')
 					{
 						$result = @call_user_func_array(array($class, 'create'), $parameters);