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

Bug #17826 Error with multiple requests with same HTTP_Request2 and Socket implementation
Submitted: 2010-08-27 20:08 UTC
From: cruzfernandez Assigned: avb
Status: Closed Package: HTTP_Request2 (version 0.5.2)
PHP Version: Irrelevant OS:
Roadmaps: 0.6.0    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 14 + 2 = ?

 
 [2010-08-27 20:08 UTC] cruzfernandez (Cruz Fernandez)
Description: ------------ Calling twice on an URL with redirects and "follow_redirects" activated, counts incorrectly the number of redirects (if they are consumed by the first request, second request has fewer redirects available :). Test script: --------------- <?php include 'PEAR.php'; function __autoload($className) { $file = str_replace('_', '/', $className) . '.php'; include $file; } $http = new HTTP_Request2; $http->setConfig('follow_redirects', true); $http->setConfig('max_redirects', 10); $http->setUrl('http://www.nytimes.com/2009/11/14/us/14terror.html'); echo "calling first time correctly\n"; $http->send(); echo "calling second time without resetting correctly\n"; $http->send(); ?> Expected result: ---------------- calling first time correctly calling second time without resetting correctly Actual result: -------------- calling first time correctly calling second time without resetting correctly Fatal error: Uncaught HTTP_Request2_Exception: Maximum (10) redirects followed in /usr/share/php/HTTP/Request2/Adapter/Socket.php on line 202 #0 /usr/share/php/HTTP/Request2/Adapter/Socket.php(202): HTTP_Request2_Adapter_Socket->handleRedirect(Object(HTTP_Request2), Object(HTTP_Request2_Response)) #1 /usr/share/php/HTTP/Request2/Adapter/Socket.php(456): HTTP_Request2_Adapter_Socket->sendRequest(Object(HTTP_Request2)) #2 /usr/share/php/HTTP/Request2/Adapter/Socket.php(202): HTTP_Request2_Adapter_Socket->handleRedirect(Object(HTTP_Request2), Object(HTTP_Request2_Response)) #3 /usr/share/php/HTTP/Request2.php(816): HTTP_Request2_Adapter_Socket->sendRequest(Object(HTTP_Request2)) #4 /home/cruz/dev/projects/easybib/socket.php(15): HTTP_Request2->send() #5 {main} thrown in /usr/share/php/HTTP/Request2/Adapter/Socket.php on line 423

Comments

 [2011-02-13 19:05 UTC] avb (Alexey Borzov)
-Status: Open +Status: Closed -Assigned To: +Assigned To: avb
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.