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

Commit

Permalink
Merge branch 'hotfix/3767' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Server/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ protected function _handle()

$orderedParams = array();
foreach ($reflection->getParameters() as $refParam) {
if (isset( $params[ $refParam->getName() ] )) {
if (array_key_exists($refParam->getName(), $params)) {
$orderedParams[ $refParam->getName() ] = $params[ $refParam->getName() ];
} elseif ($refParam->isOptional()) {
$orderedParams[ $refParam->getName() ] = null;
Expand Down
14 changes: 14 additions & 0 deletions test/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,20 @@ public function testHandleValidMethodShouldWork()
$this->assertFalse($response->isError());
}

public function testHandleValidMethodWithNULLParamValueShouldWork()
{
$this->server->setClass('ZendTest\\Json\\Foo')
->addFunction('ZendTest\\Json\\FooFunc')
->setReturnResponse(true);
$request = $this->server->getRequest();
$request->setMethod('bar')
->setParams(array(true, NULL, 'bar'))
->setId('foo');
$response = $this->server->handle();
$this->assertTrue($response instanceof Response);
$this->assertFalse($response->isError());
}

public function testHandleValidMethodWithTooFewParamsShouldPassDefaultsOrNullsForMissingParams()
{
$this->server->setClass('ZendTest\Json\Foo')
Expand Down

0 comments on commit 6d4e64c

Please sign in to comment.