8000 Fix #81 CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS errors on PH… · moiAK/codebird-php@a2b71ca · GitHub
[go: up one dir, main page]

Skip to content

Commit a2b71ca

Browse files
committed
Fix jublo#81 CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS errors on PHP 5.3
1 parent 2e77485 commit a2b71ca

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ codebird-php - changelog
77
+ #69 Add composer/installers to allow install path changes
88
- Regression: Codebird::getApiMethods removed accidentally in 2.5.0
99
+ #66 Allow remote media uploads
10+
- #81 CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS errors on PHP 5.3
1011

1112
2.5.0 (2014-06-20)
1213
+ Add section about cacert.pem to README

src/codebird.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
'CURLE_SSL_CACERT' => 60,
2727
'CURLE_SSL_CACERT_BADFILE' => 77,
2828
'CURLE_SSL_CRL_BADFILE' => 82,
29-
'CURLE_SSL_ISSUER_ERROR' => 83
29+
'CURLE_SSL_ISSUER_ERROR' => 83,
30+
// workaround for http://php.net/manual/en/function.curl-setopt.php#107314
31+
'_CURLOPT_TIMEOUT_MS' => 155,
32+
'_CURLOPT_CONNECTTIMEOUT_MS' => 156
3033
);
3134
foreach ($constants as $id => $i) {
3235
defined($id) or define($id, $i);
@@ -1165,8 +1168,8 @@ protected function _buildMultipart($method, $params)
11651168
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
11661169
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
11671170
// use hardcoded download timeouts for now
1168-
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 5000);
1169-
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 2000);
1171+
curl_setopt($ch, _CURLOPT_TIMEOUT_MS, 5000);
1172+
curl_setopt($ch, _CURLOPT_CONNECTTIMEOUT_MS, 2000);
11701173
$result = curl_exec($ch);
11711174
if ($result !== false) {
11721175
$value = $result;
@@ -1329,11 +1332,11 @@ protected function _callApiCurl(
13291332
curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . '/cacert.pem');
13301333

13311334
if (isset($this->_timeout)) {
1332-
curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->_timeout);
1335+
curl_setopt($ch, _CURLOPT_TIMEOUT_MS, $this->_timeout);
13331336
}
13341337

13351338
if (isset($this->_connectionTimeout)) {
1336-
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->_connectionTimeout);
1339+
curl_setopt($ch, _CURLOPT_CONNECTTIMEOUT_MS, $this->_connectionTimeout);
13371340
}
13381341

13391342
$result = curl_exec($ch);

0 commit comments

Comments
 (0)
0