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

Bug #15721 Curl handle not closed if curl_exec returns false (curl-adapter)
Submitted: 2009-01-22 09:43 UTC Modified: 2009-01-22 18:21 UTC
From: kase Assigned: avb
Status: Closed Package: HTTP_Request2 (version 0.2.0)
PHP Version: 5.2.8 OS:
Roadmaps: 0.3.0    
Subscription  


 [2009-01-22 09:43 UTC] kase (Timo Gmell)
Description: ------------ Fix: Add these lines in Curl.php after line 125: $errno = curl_errno($ch); $error = curl_error($ch); // there is no problem on updating lastInfo on error too $this->lastInfo = curl_getinfo($ch); curl_close($ch); throw new HTTP_Request2_Exception('Error sending request: #' . $errno . ' ' . $error);

Comments

 [2009-01-22 10:28 UTC] kase (Timo Gmell)
If there is an exception in a callback or in an observer, the curl handle is not closed too. Improved patch Curl.php after line 125: $ch = $this->createCurlHandle(); $result = false; try { $result = curl_exec($ch); } catch (Exception $e) { // exception in callback or observer $this->lastInfo = curl_getinfo($ch); curl_close($ch); throw $e; } $this->lastInfo = curl_getinfo($ch); if (!$result) { $errno = curl_errno($ch); $error = curl_error($ch); curl_close($ch); throw new HTTP_Request2_Exception('Error sending request: #' . $errno . ' ' . $error); } curl_close($ch); if (0 < $this->lastInfo['size_download']) {...
 [2009-01-22 18:21 UTC] avb (Alexey Borzov)
This bug has been fixed in CVS. 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.