svn: /pear2/HTTP_Request/trunk/src/HTTP/Request/Adapter/ Curl.php
[email protected] (Brett Bieber) Thu, 10 Feb 2011 15:11:07 +0000
| Newsgroups | php.pear.cvs,php.pear.core |
|---|---|
| Message-ID | <[email protected]> |
saltybeagle Thu, 10 Feb 2011 15:11:07 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=308201
Log:
Patch from Amir. When curl_exec() returns false, throw an exception. Not throwing an exception would lead to a bogus PEAR2\HTTP\Request\Response::__toString() (trying to return boolean false, when __toString() should return only string), and no way to realize if the request was executed or not.
Changed paths:
U pear2/HTTP_Request/trunk/src/HTTP/Request/Adapter/Curl.php
Modified: pear2/HTTP_Request/trunk/src/HTTP/Request/Adapter/Curl.php
===================================================================
--- pear2/HTTP_Request/trunk/src/HTTP/Request/Adapter/Curl.php 2011-02-10 15:10:15 UTC (rev 308200)
+++ pear2/HTTP_Request/trunk/src/HTTP/Request/Adapter/Curl.php 2011-02-10 15:11:07 UTC (rev 308201)
@@ -93,6 +93,13 @@
protected function _sendRequest()
{
$body = curl_exec($this->curl);
+
+ if (false === $body) {
+ throw new Request\Exception(
+ 'Curl ' . curl_error($this->curl) . ' (' . curl_errno($this->curl) . ')'
+ );
+ }
+
$this->sentFilesize = false;
if ($this->fp !== false) {