Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix error handling

  • Loading branch information...
commit 25700d1a67e3e8be272a29d0417286f6fd68d025 1 parent 6a0eb92
Charles Pick authored

Showing 2 changed files with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. +1 1  ACurl.php
  2. +4 1 ACurlResponse.php
2  ACurl.php
@@ -219,7 +219,7 @@ protected function exec() {
219 219 $response->data = false;
220 220 }
221 221 }
222   - if ($response->getIsError()) {
  222 + if ($response->getIsError() && $response->getLastHeaders() !== false) {
223 223 throw new ACurlException($response->getLastHeaders()->http_code,"Curl Error: ".$response->getLastHeaders()->http_code,$response);
224 224 }
225 225 if (curl_error($this->getHandle())) {
5 ACurlResponse.php
@@ -64,7 +64,10 @@ public function setInfo($value) {
64 64 * @return CAttributeCollection the headers
65 65 */
66 66 public function getLastHeaders() {
67   - return $this->getHeaders()->itemAt(0);
  67 + if ($this->getHeaders()->count() > 0) {
  68 + return $this->getHeaders()->itemAt(0);
  69 + }
  70 + return false;
68 71 }
69 72
70 73 /**

0 comments on commit 25700d1

Please sign in to comment.
Something went wrong with that request. Please try again.