Skip to content

Commit 1d786ca

Browse files
authored
Merge pull request php-curl-class#386 from zachborboa/updates
Add PHP 7.1 to continuous integration tests
2 parents ecbe65a + 7f66973 commit 1d786ca

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ php:
66
- 5.5
77
- 5.6
88
- 7.0
9+
- 7.1
910
- hhvm
1011
- nightly
1112

1213
matrix:
1314
allow_failures:
15+
- php: 7.1
1416
- php: nightly
1517

1618
before_script:

examples/multi_curl_upload_file.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
require __DIR__ . '/vendor/autoload.php';
3+
4+
use \Curl\MultiCurl;
5+
6+
$multi_curl = new MultiCurl();
7+
8+
// HINT: If API documentation refers to using something like curl -F "myimage=image.png",
9+
// curl --form "myimage=image.png", or the html form is similar to <form enctype="multipart/form-data" method="post">,
10+
// then try uncommenting the following line:
11+
// $multi_curl->setHeader('Content-Type', 'multipart/form-data');
12+
13+
$multi_curl->addPost('https://httpbin.org/post', array(
14+
'image' => new CURLFile('the-lorax.jpg'),
15+
));
16+
17+
$multi_curl->addPost('https://httpbin.org/post', array(
18+
'image' => new CURLFile('swomee-swans.jpg'),
19+
));
20+
21+
$multi_curl->addPost('https://httpbin.org/post', array(
22+
'image' => new CURLFile('truffula-trees.jpg'),
23+
));
24+
25+
$multi_curl->start();

src/Curl/Curl.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,10 @@ public function exec($ch = null)
350350

351351
// Include additional error code information in error message when possible.
352352
if ($this->curlError && function_exists('curl_strerror')) {
353-
$this->curlErrorMessage = curl_strerror($this->curlErrorCode) . ': ' . $this->curlErrorMessage;
353+
$this->curlErrorMessage =
354+
curl_strerror($this->curlErrorCode) . (
355+
empty($this->curlErrorMessage) ? '' : ': ' . $this->curlErrorMessage
356+
);
354357
}
355358

356359
$this->httpStatusCode = $this->getInfo(CURLINFO_HTTP_CODE);

0 commit comments

Comments
 (0)