Skip to content

Commit b8a5c46

Browse files
committed
Fixes for working on PHP > 7.0
- Fixed `count()` issue with PHP 7.2 (issue #72) - `kriswallsmith/buzz` constrained to `^0.16` from `~0.15` in order to work on PHP > 7.0 (issue #73) fixes #72 fixes #73
1 parent 39a550d commit b8a5c46

File tree

5 files changed

+44
-5
lines changed

5 files changed

+44
-5
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ php:
66
- 5.5
77
- 5.6
88
- 7.0
9+
- 7.1
10+
- 7.2
911
- hhvm
1012

1113
matrix:

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55

6+
## 1.1.1 / 2018-06-11
7+
8+
### Fixed:
9+
- Fixed `count()` issue with PHP 7.2 (issue #72)
10+
- `kriswallsmith/buzz` constrained to `^0.16` from `~0.15` in order to work on PHP > 7.0 (issue #73)
11+
12+
613
## 1.1.0 / 2017-11-06
714

815
### Added:
@@ -11,6 +18,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1118
### Changed:
1219
- Added $params arg to Repositories:all method (issue #65)
1320

21+
### Fixed:
22+
- Include format param only in API v1
23+
1424
[Pipeline]: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pipelines
1525

1626

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
],
1616
"require": {
1717
"php": ">=5.4.0",
18-
"kriswallsmith/buzz": "~0.15",
18+
"kriswallsmith/buzz": "^0.16",
1919
"jacobkiers/oauth": "~1.0"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "3.7.*",
22+
"phpunit/phpunit": "^4.8",
2323
"squizlabs/php_codesniffer": "~2.7"
2424
},
2525
"conflict": {

lib/Bitbucket/API/Http/Client.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Client extends ClientListener implements ClientInterface
3232
'api_versions' => array('1.0', '2.0'), // supported versions
3333
'format' => 'json',
3434
'formats' => array('json', 'xml'), // supported response formats
35-
'user_agent' => 'bitbucket-api-php/1.1.0 (https://bitbucket.org/gentlero/bitbucket-api)',
35+
'user_agent' => 'bitbucket-api-php/1.1.1 (https://bitbucket.org/gentlero/bitbucket-api)',
3636
'timeout' => 10,
3737
'verify_peer' => true
3838
);
@@ -125,8 +125,13 @@ public function request($endpoint, $params = array(), $method = 'GET', array $he
125125
$request->addHeaders($headers);
126126
}
127127

128-
if (count($params) > 0) {
129-
$request->setContent(is_array($params) ? http_build_query($params) : $params);
128+
$paramsString = null;
129+
if (is_array($params) && count($params) > 0) {
130+
$paramsString = http_build_query($params);
131+
}
132+
133+
if (is_string($paramsString) && $paramsString !== null) {
134+
$request->setContent($paramsString);
130135
}
131136

132137
$response = is_object($this->responseObj) ? $this->responseObj : new Response();

test/Bitbucket/Tests/API/Repositories/HooksTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,28 @@ public function testCreateSuccess()
9494
$hooks->create('gentle', 'eof', $params);
9595
}
9696

97+
/**
98+
* @ticket 72
99+
*/
100+
public function testCreateIssue72()
101+
{
102+
$params = array(
103+
'description' => 'My first webhook',
104+
'url' => 'http://requestb.in/xxx',
105+
'active' => true,
106+
'events' => array(
107+
'repo:push',
108+
'issue:created',
109+
)
110+
);
111+
112+
/** @var \Bitbucket\API\Repositories\Hooks $hooks */
113+
$hooks = $this->getClassMock('Bitbucket\API\Repositories\Hooks', $this->getHttpClient());
114+
$response = $hooks->create('gentle', 'eof', $params);
115+
116+
$this->assertInstanceOf('Buzz\Message\MessageInterface', $response);
117+
}
118+
97119
public function testCreateSuccessWithExtraParameters()
98120
{
99121
$endpoint = 'repositories/gentle/eof/hooks';

0 commit comments

Comments
 (0)