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

Issue Type: Bug Created: 2010-03-11T07:19:29.000+0000 Last Updated: 2011-06-10T15:43:49.000+0000 Status: Resolved Fix version(s): - 1.10.4 (28/Apr/10)

Reporter: Eutychus (eutychus) Assignee: Shahar Evron (shahar) Tags: - Zend_Http_Client

Related issues: - ZF-11469



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


Posted by Eutychus (eutychus) on 2010-03-11T07:47:39.000+0000

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'])) {

Posted by Shahar Evron (shahar) on 2010-04-06T04:43:30.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.