Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0

Bug #20228 invalid chunk length ''
Submitted: 2014-03-29 13:13 UTC
From: cweiske Assigned: avb
Status: Closed Package: HTTP_Request2 (version 2.2.1)
PHP Version: 5.5.3 OS:
Roadmaps: (Not assigned)    

 [2014-03-29 13:13 UTC] cweiske (Christian Weiske)
Description: ------------ Fetching via HTTP GET fails because of HTTP_Request2_MessageException: Cannot decode chunked response, invalid chunk length '' Test script: --------------- <?php require 'HTTP/Request2.php'; $req = new HTTP_Request2(); $req->setUrl(''); $req->send(); ?> Expected result: ---------------- no error. Browsers can show the page without problems. Actual result: -------------- PHP Fatal error: Uncaught HTTP_Request2_MessageException: Cannot decode chunked response, invalid chunk length '' in /usr/share/php/HTTP/Request2/Adapter/Socket.php on line 1056 #0 /usr/share/php/HTTP/Request2/Adapter/Socket.php(1056): HTTP_Request2_Adapter_Socket->readChunked(16384) #1 /usr/share/php/HTTP/Request2/Adapter/Socket.php(136): HTTP_Request2_Adapter_Socket->readResponse() #2 /usr/share/php/HTTP/Request2.php(939): HTTP_Request2_Adapter_Socket->sendRequest(Object(HTTP_Request2)) #3 /home/cweiske/Dev/pear/test-http_request2-schou.php(5): HTTP_Request2->send() #4 {main} thrown in /usr/share/php/HTTP/Request2/Adapter/Socket.php on line 1099


 [2014-04-02 16:25 UTC] duybinh0208 (Binh Duy)
I have the same bug "Cannot decode chunked response, invalid chunk length" like Christian Weiske mentions. Any idea for this issue?
 [2014-04-04 07:07 UTC] duybinh0208 (Binh Duy)
I found by myself that wampserver with apache 2.4.2 has some problems. Just change version of apache to 2.4.2 by installing another version of wampserver and everything works well. Thanks.
 [2014-04-12 14:07 UTC] avb (Alexey Borzov)
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: avb
The site sends invalid chunked response that does not contain last-chunk as described in This can probably be handled without an exception, though, just reading the response until eof
 [2015-06-23 17:26 UTC] avb (Alexey Borzov)
For the record: the site in question reports Apache 2.2.22, so this is most probably a known bug in mod_proxy Another thing to consider is that console curl outputs error 18 (CURLE_PARTIAL_FILE) if trying to access that site, curl_exec() in Curl Adapter returns the data, but curl_errno() on handle also returns error 18. Perhaps a means to add warnings to HTTP_Request2_Response should be devised for situations like this where a "hard" Exception is a bit too much. Or maybe a 'warning' event for Observers?
 [2015-06-30 00:19 UTC] avb (Alexey Borzov)
-Status: Analyzed +Status: Closed
Fixed in Git: Also a new 'warning' event is dispatched to Observers if incomplete body was received.