From 64277a5b03846552603e4761c60e242ec51a33bd Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 1 Feb 2016 11:16:36 +0000 Subject: [PATCH] Error: trim() expects parameter 1 to be string, array given - library/Zend/Http/Client.php:1127 We have seen occasions where the location header is returned as an array, but the code assumes we'll be dealing with a string, so check for that and reset the array where applicable. --- library/Zend/Http/Client.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/Zend/Http/Client.php b/library/Zend/Http/Client.php index b704249cc2..777870bfa2 100644 --- a/library/Zend/Http/Client.php +++ b/library/Zend/Http/Client.php @@ -1122,6 +1122,11 @@ public function request($method = null) // If we got redirected, look for the Location header if ($response->isRedirect() && ($location = $response->getHeader('location'))) { + // Location header can be returned as an array + if (is_array($location)) { + $location = reset($location); + } + // Avoid problems with buggy servers that add whitespace at the // end of some headers (See ZF-11283) $location = trim($location);