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

Commit

Permalink
Merged Source/Master
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
"dev-master": "2.1-dev",
"dev-develop": "2.2-dev"
}
},
"autoload-dev": {
Expand Down
8 changes: 5 additions & 3 deletions src/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ public static function encode($valueToEncode, $cycleCheck = false, $options = ar
* NOTE: This method is used internally by the encode method.
*
* @see encode
* @param mixed $valueToCheck a string - object property to be encoded
* @return void
* @param mixed $value a string - object property to be encoded
* @param array $javascriptExpressions
* @param null|string|int $currentKey
* @return mixed
*/
protected static function _recursiveJsonExprFinder(
&$value, array &$javascriptExpressions, $currentKey = null
Expand Down Expand Up @@ -306,7 +308,7 @@ protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttribu
* @return mixed - JSON formatted string on success
* @throws \Zend\Json\Exception\RuntimeException if the input not a XML formatted string
*/
public static function fromXml ($xmlStringContents, $ignoreXmlAttributes=true)
public static function fromXml($xmlStringContents, $ignoreXmlAttributes = true)
{
// Load the XML formatted string into a Simple XML Element object.
$simpleXmlElementObject = simplexml_load_string($xmlStringContents);
Expand Down
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 6eac5f2

Please # to comment.