ZF-9404: Problem with Duplicate content-length Header in Http/Socket.php (Line 423)


If I Request a file producing duplicate content-length header I get an error message:

Fatal error: Unsupported operand types in /pathtozendframework/Zend/Http/Client/Adapter/Socket.php on line 423

code there:

        for ($read_to = $current_pos + $headers['content-length'];
             $read_to > $current_pos;
             $current_pos = ftell($this->socket)) {

Problem is the $headers['content-length'] which in this case is an Array.

The Server URL Requested:…

The Request Header looks like this:

HTTP/1.1 200 OK Connection: close Date: Thu, 11 Mar 2010 15:03:34 GMT Server: Microsoft-IIS/6.0 P3P: CP="CAO PSA OUR" X-Powered-By: ASP.NET Content-Disposition: inline; filename=01_Chevette.mp3 Content-Length: 174652 Content-Length: 174652 Content-Type: audio/mpeg3 Expires: Thu, 11 Mar 2010 15:03:33 GMT Set-Cookie: ASPSESSIONIDQQBQCATQ=CCLFNMPAOEPDMEDEOMFMDDCJ; path=/ Cache-control: private


Maybe you could use first Element of Array

Or prefer using the Fallback way testing for array in condition above.

// Else, if we got the content-length header, read this number of bytes } elseif (isset($headers['content-length']) && !is_array($header['content-length'])) {

Fixed in r. 21777, fix merged to 1.10 release branch