X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FCurlResult.php;h=1a475c7cec959983a2c5312a806ab29aa8b3e76b;hb=a60a440c9af0caf5127c47bb59531138c906ea75;hp=eb446af4e75336ec6608a69883544cfe782b6884;hpb=491fc5f78aadb787a57a0f0630779f457ff1bcb4;p=friendica.git diff --git a/src/Network/CurlResult.php b/src/Network/CurlResult.php index eb446af4e7..1a475c7cec 100644 --- a/src/Network/CurlResult.php +++ b/src/Network/CurlResult.php @@ -77,6 +77,7 @@ class CurlResult * @param string $url optional URL * * @return CurlResult a CURL with error response + * @throws InternalServerErrorException */ public static function createErrorCurl($url = '') { @@ -161,11 +162,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'];