Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
language: php
php:
- '7.0'
- '7.1'
- '7.2'
- nightly

matrix:
allow_failures:
- php: hhvm

before_script:
- composer install

Expand Down
80 changes: 80 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- php 7 type hints.
- This changelog

### Removed
- php 5 support.
- php 7.1 support.

### Fixed
- Incorrect handling of uninitialized pass-by-ref argument in `CurlMulti::exec()` (#8).

### Changed
- Documentation to reflect the interfaces.

## [2.1.0] - 2017-01-20
### Added
- `CurlInterface`.
- `CurlMultiInterface`.
- `CurlShareInterface`.

## [2.0.1] - 2017-01-20
### Changed
- Minor documentation improvements.

## [2.0.0] - 2017-01-20
### Added
- `Curl` object destructor to close the handler.
- `Curl::getHandle()`.
- `CurlMulti::init()`.
- `CurlShare::init()`.

### Removed
- php 5.3 and 5.4 support.
- Retry on failure feature.
- `CurlException` class.

### Changed
- `Curl::version`, `Curl::strError`, `CurlMulti::strError` are not static anymore.

## [1.0.0] - 2016-02-02
### Changed
- The library moved to "phpcurl/curlwrapper".

## [0.1.2] - 2016-02-02
### Fixed
- The `$opt` flag should not be artificially set to 0.

## [0.1.1] - 2016-01-21
### Changed
- Minor documentation improvements.

## [0.1.0] - 2016-01-21
### Added
- Documentation
- `CurlException` class.

## [0.0.2] - 2014-02-19
### Changed
- Test cleanup.

## 0.0.1 - 2014-02-17
### Added
- Initial version.

[Unreleased]: https://github.com/phpcurl/curlwrapper/compare/2.1.0...HEAD
[2.1.0]: https://github.com/phpcurl/curlwrapper/compare/2.0.1...2.1.0
[2.0.1]: https://github.com/phpcurl/curlwrapper/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/phpcurl/curlwrapper/compare/1.0.0...2.0.0
[1.0.0]: https://github.com/phpcurl/curlwrapper/compare/0.1.2...1.0.0
[0.1.2]: https://github.com/phpcurl/curlwrapper/compare/0.1.1...0.1.2
[0.1.1]: https://github.com/phpcurl/curlwrapper/compare/0.1.0...0.1.1
[0.1.0]: https://github.com/phpcurl/curlwrapper/compare/0.0.2...0.1.0
[0.0.2]: https://github.com/phpcurl/curlwrapper/compare/0.0.1...0.0.2
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
}
],
"require": {
"php": ">=7.0.0",
"php": ">=7.1.0",
"ext-curl": "*"
},
"require-dev": {
"phpunit/phpunit": "^4.8 || ^5.0",
"phpunit/phpunit": "^7.0",
"squizlabs/php_codesniffer": "^2.0"
},
"autoload": {
Expand Down
3 changes: 1 addition & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
verbose="true"
syntaxCheck="true">
verbose="true">
<testsuites>
<testsuite name="Main">
<directory>./test</directory>
Expand Down
5 changes: 3 additions & 2 deletions src/CurlMulti.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace PHPCurl\CurlWrapper;

class CurlMulti implements CurlMultiInterface
Expand Down Expand Up @@ -40,15 +41,15 @@ public function add(CurlInterface $curl): int
/**
* @inheritdoc
*/
public function exec(int &$stillRunning): int
public function exec(int &$stillRunning = null): int
{
return curl_multi_exec($this->handle, $stillRunning);
}

/**
* @inheritdoc
*/
public function getContent(CurlInterface $curl): string
public function getContent(CurlInterface $curl): ?string
{
return curl_multi_getcontent($curl->getHandle());
}
Expand Down
6 changes: 3 additions & 3 deletions src/CurlMultiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public function add(CurlInterface $curl): int;
* @param int $stillRunning Flag
* @return int (One of CURLM_* constants)
*/
public function exec(int &$stillRunning): int;
public function exec(int &$stillRunning = null): int;

/**
* @see curl_multi_getcontent()
*
* @param CurlInterface $curl
* @return string
* @return string|null
*/
public function getContent(CurlInterface $curl): string;
public function getContent(CurlInterface $curl): ?string;

/**
* @see curl_multi_info_read()
Expand Down
13 changes: 8 additions & 5 deletions test/CurlMultiTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace PHPCurl\CurlWrapper;

use PHPUnit\Framework\TestCase;

function curl_multi_init()
{
return 'foo';
Expand Down Expand Up @@ -28,7 +31,7 @@ function curl_multi_getcontent($h)

function curl_multi_strerror($c)
{
return 'strerror_'.$c;
return 'strerror_' . $c;
}

function curl_multi_select($h, $t)
Expand All @@ -38,7 +41,7 @@ function curl_multi_select($h, $t)

function curl_multi_close($h)
{
CurlMultiTest::$log[] = 'close_'.$h;
CurlMultiTest::$log[] = 'close_' . $h;
}

function curl_multi_info_read($h, &$m)
Expand All @@ -50,12 +53,12 @@ function curl_multi_info_read($h, &$m)
function curl_multi_exec($h, &$r)
{
$r = 24;
return $h === 'foo' ? 1 : 0;
return $h === 'foo' ? 1 : 0;
}

class CurlMultiTest extends \PHPUnit_Framework_TestCase
class CurlMultiTest extends TestCase
{
static public $log = array();
static public $log = [];

public function testAll()
{
Expand Down
4 changes: 3 additions & 1 deletion test/CurlShareTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace PHPCurl\CurlWrapper;

use PHPUnit\Framework\TestCase;

function curl_share_close($h)
{
CurlShareTest::$log[] = 'close_'.$h;
Expand All @@ -16,7 +18,7 @@ function curl_share_setopt($h, $o, $v)
return $h === 'foo' && $o === 0 && $v === 'val';
}

class CurlShareTest extends \PHPUnit_Framework_TestCase
class CurlShareTest extends TestCase
{
static public $log = array();

Expand Down
6 changes: 4 additions & 2 deletions test/CurlTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace PHPCurl\CurlWrapper;

use PHPUnit\Framework\TestCase;

function curl_close($h)
{
CurlTest::$log[] = [__FUNCTION__, func_get_args()];
Expand Down Expand Up @@ -88,7 +90,7 @@ function curl_errno($h)
return 42;
}

class CurlTest extends \PHPUnit_Framework_TestCase
class CurlTest extends TestCase
{
static public $log = [];

Expand Down Expand Up @@ -119,7 +121,7 @@ public function testAll()
],
[
'PHPCurl\\CurlWrapper\\curl_version',
[3],
[\CURLVERSION_NOW],
],
[
'PHPCurl\\CurlWrapper\\curl_strerror',
Expand Down