From d52d4ca35562411a172dcb94fd9218bad1a5b8f2 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Wed, 5 Dec 2018 06:01:58 +0000
Subject: [PATCH] Avoids the notice "array_merge(): Argument #1 is not an
 array"

---
 src/Network/CurlResult.php | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/Network/CurlResult.php b/src/Network/CurlResult.php
index eb446af4e7..1aafbfa9b8 100644
--- a/src/Network/CurlResult.php
+++ b/src/Network/CurlResult.php
@@ -161,11 +161,21 @@ class CurlResult
 
 		if ($this->returnCode == 301 || $this->returnCode == 302 || $this->returnCode == 303 || $this->returnCode== 307) {
 			$redirect_parts = parse_url(defaults($this->info, 'redirect_url', ''));
+			if (empty($redirect_parts)) {
+				$redirect_parts = [];
+			}
+
 			if (preg_match('/(Location:|URI:)(.*?)\n/i', $this->header, $matches)) {
-				$redirect_parts = array_merge($redirect_parts, parse_url(trim(array_pop($matches))));
+				$redirect_parts2 = parse_url(trim(array_pop($matches)));
+				if (!empty($redirect_parts2)) {
+					$redirect_parts = array_merge($redirect_parts, $redirect_parts2);
+				}
 			}
 
 			$parts = parse_url(defaults($this->info, 'url', ''));
+			if (empty($parts)) {
+				$parts = [];
+			}
 
 			/// @todo Checking the corresponding RFC which parts of a redirect can be ommitted.
 			$components = ['scheme', 'host', 'path', 'query', 'fragment'];