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

Commit

Permalink
Merge branch 'master' of github.com:zendframework/zf2 into feature/ro…
Browse files Browse the repository at this point in the history
…uter-http-method
  • Loading branch information
mpinkston committed May 16, 2012
2 parents 491f302 + 3ddf1a3 commit a8ab5b0
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 11 deletions.
1 change: 1 addition & 0 deletions .travis/skipped-components
@@ -1,5 +1,6 @@
Zend/Amf
Zend/Date
Zend/Dojo
Zend/Queue
Zend/Service
Zend/Test
Expand Down
3 changes: 3 additions & 0 deletions src/Decoder.php
Expand Up @@ -223,6 +223,9 @@ protected function _decodeObject()
// Create new StdClass and populate with $members
$result = new \stdClass();
foreach ($members as $key => $value) {
if ($key === '') {
$key = '_empty_';
}
$result->$key = $value;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions src/Exception.php → src/Exception/ExceptionInterface.php
Expand Up @@ -18,13 +18,13 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Json;
namespace Zend\Json\Exception;

/**
* @category Zend
* @package Zend_Json
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception
interface ExceptionInterface
{}
4 changes: 3 additions & 1 deletion src/Exception/InvalidArgumentException.php
Expand Up @@ -26,5 +26,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class InvalidArgumentException extends \InvalidArgumentException implements \Zend\Json\Exception
class InvalidArgumentException
extends \InvalidArgumentException
implements ExceptionInterface
{}
4 changes: 3 additions & 1 deletion src/Exception/RuntimeException.php
Expand Up @@ -26,5 +26,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class RuntimeException extends \RuntimeException implements \Zend\Json\Exception
class RuntimeException
extends \RuntimeException
implements ExceptionInterface
{}
5 changes: 2 additions & 3 deletions src/Server/Exception/ErrorException.php
Expand Up @@ -21,8 +21,7 @@

namespace Zend\Json\Server\Exception;

use BadMethodCallException,
Zend\Json\Server\Exception;
use BadMethodCallException;

/**
* Thrown by Zend\Json\Server\Client when an JSON-RPC fault response is returned.
Expand All @@ -35,5 +34,5 @@
*/
class ErrorException
extends BadMethodCallException
implements Exception
implements ExceptionInterface
{}
Expand Up @@ -18,7 +18,9 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Json\Server;
namespace Zend\Json\Server\Exception;

use Zend\Json\Exception\ExceptionInterface as Exception;

/**
* @category Zend
Expand All @@ -27,5 +29,5 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception extends \Zend\Json\Exception
interface ExceptionInterface extends Exception
{}
6 changes: 5 additions & 1 deletion src/Server/Exception/InvalidArgumentException.php
Expand Up @@ -20,12 +20,16 @@

namespace Zend\Json\Server\Exception;

use Zend\Json\Exception;

/**
* @category Zend
* @package Zend_Json
* @subpackage Server
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class InvalidArgumentException extends \InvalidArgumentException implements \Zend\Json\Server\Exception
class InvalidArgumentException
extends Exception\InvalidArgumentException
implements ExceptionInterface
{}
6 changes: 5 additions & 1 deletion src/Server/Exception/RuntimeException.php
Expand Up @@ -20,12 +20,16 @@

namespace Zend\Json\Server\Exception;

use Zend\Json\Exception;

/**
* @category Zend
* @package Zend_Json
* @subpackage Server
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class RuntimeException extends \RuntimeException implements \Zend\Json\Server\Exception
class RuntimeException
extends Exception\RuntimeException
implements ExceptionInterface
{}
13 changes: 13 additions & 0 deletions test/JsonTest.php
Expand Up @@ -847,6 +847,19 @@ public function testWillEncodeArrayOfObjectsEachWithToJsonMethod()
$this->assertEquals($expected, $json);
}

/**
* @group ZF-7586
*/
public function testWillDecodeStructureWithEmptyKeyToObjectProperly()
{
Json\Json::$useBuiltinEncoderDecoder = true;

$json = '{"":"test"}';
$object = Json\Json::decode($json, Json\Json::TYPE_OBJECT);
$this->assertTrue(isset($object->_empty_));
$this->assertEquals('test', $object->_empty_);
}

}

/**
Expand Down

0 comments on commit a8ab5b0

Please sign in to comment.