Merge pull request #6235 from annando/curl-notice
Avoids the notice "array_merge(): Argument #1 is not an array"
This commit is contained in:
commit
8416dea3cd
1 changed files with 11 additions and 1 deletions
|
@ -161,11 +161,21 @@ class CurlResult
|
||||||
|
|
||||||
if ($this->returnCode == 301 || $this->returnCode == 302 || $this->returnCode == 303 || $this->returnCode== 307) {
|
if ($this->returnCode == 301 || $this->returnCode == 302 || $this->returnCode == 303 || $this->returnCode== 307) {
|
||||||
$redirect_parts = parse_url(defaults($this->info, 'redirect_url', ''));
|
$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)) {
|
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', ''));
|
$parts = parse_url(defaults($this->info, 'url', ''));
|
||||||
|
if (empty($parts)) {
|
||||||
|
$parts = [];
|
||||||
|
}
|
||||||
|
|
||||||
/// @todo Checking the corresponding RFC which parts of a redirect can be ommitted.
|
/// @todo Checking the corresponding RFC which parts of a redirect can be ommitted.
|
||||||
$components = ['scheme', 'host', 'path', 'query', 'fragment'];
|
$components = ['scheme', 'host', 'path', 'query', 'fragment'];
|
||||||
|
|
Loading…
Reference in a new issue