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 git://github.com/zendframework/zf2 into cach…
Browse files Browse the repository at this point in the history
…e_interfaces
  • Loading branch information
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
travisdir=$(dirname $(readlink /proc/$$/fd/255))
travisdir=$(dirname "$0")
testdir="$travisdir/../tests"
testedcomponents=(`cat "$travisdir/tested-components"`)
result=0
Expand Down
1 change: 1 addition & 0 deletions .travis/skipped-components
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Zend/Amf
Zend/Date
Zend/Dojo
Zend/Queue
Zend/Service
Zend/Test
Expand Down
4 changes: 3 additions & 1 deletion .travis/tested-components
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ Zend/Form
Zend/GData
Zend/Http
Zend/InfoCard
Zend/InputFilter
Zend/Json
Zend/Ldap
Zend/Loader
Zend/Locale
Zend/Log
Zend/Mail
Zend/Markup
Zend/Math
Zend/Measure
Zend/Memory
Zend/Mime
Zend/Module
Zend/ModuleManager
Zend/Mvc
Zend/Navigation
Zend/OAuth
Expand Down
3 changes: 3 additions & 0 deletions src/Decoder.php
Original file line number Diff line number Diff line change
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
33 changes: 33 additions & 0 deletions src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Json
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Json\Exception;

/**
* @category Zend
* @package Zend_Json
* @subpackage Exception
* @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 BadMethodCallException extends \BadMethodCallException implements
ExceptionInterface
{}
4 changes: 2 additions & 2 deletions src/Exception.php → src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
{}
8 changes: 3 additions & 5 deletions src/Server/Exception/ErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

namespace Zend\Json\Server\Exception;

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

/**
* Thrown by Zend\Json\Server\Client when an JSON-RPC fault response is returned.
Expand All @@ -33,7 +32,6 @@
* @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 ErrorException
extends BadMethodCallException
implements Exception
class ErrorException extends Exception\BadMethodCallException implements
ExceptionInterface
{}
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 1128b0c

Please sign in to comment.