8000 Merge branch 'hotfix/2' into develop · zendframework/zend-json-server@a768034 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit a768034

Browse files
committed
Merge branch 'hotfix/2' into develop
Forward port #2
2 parents 5f4c21a + a4c42ea commit a768034

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ All notable changes to this project will be documented in this file, in reverse
2626

2727
- Nothing.
2828

29+
### Changed
30+
31+
- Nothing.
32+
2933
### Deprecated
3034

3135
- Nothing.
@@ -36,7 +40,9 @@ All notable changes to this project will be documented in this file, in reverse
3640

3741
### Fixed
3842

39-
- Nothing.
43+
- [#2](https://github.com/zendframework/zend-json-server/pull/2) fixes an issue with how the `Response::setOptions()` method would handle a
44+
key of `0`; previously, it would (incorrectly) set the JSON-RPC version of the response;
45+
now it does not.
4046

4147
## 3.0.0 - 2015-03-31
4248

src/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function setOptions(array $options)
7474
continue;
7575
}
7676

77-
if ($key == 'jsonrpc') {
77+
if ('jsonrpc' === $key) {
7878
$this->setVersion($value);
7979
continue;
8080
}

test/ResponseTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,15 @@ public function getOptions()
200200
'id' => 'foobar'
201201
];
202202
}
203+
204+
/**
205+
* @see https://github.com/zendframework/zend-json-server/pull/2
206+
*/
207+
public function testValueOfZeroForOptionsKeyShouldNotBeInterpretedAsVersionKey()
208+
{
209+
$this->response->setOptions([
210+
0 => '2.0',
211+
]);
212+
$this->assertNull($this->response->getVersion());
213+
}
203214
}

0 commit comments

Comments
 (0)
0