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

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Quoc Vu committed May 9, 2013
149 parents b0e12bf + 40d2cad + dcdecad + 978a0d2 + f68efae + 24315d0 + 90bab68 + d5240ce + a4cf61f + 737988b + 24b691f + b2ba0b2 + 3df4d2a + d37df59 + 7f0c1ad + 25ddb64 + 61dafd7 + 6eb1418 + 72e4c73 + 484fecb + 17ed9ab + 9881dbb + 6d7f5ab + 561ef2b + 567588e + ec0d061 + 3a9c051 + ffadf7b + 8c8ab46 + 56dffee + 9b3291e + 72011a1 + 79d20ae + 0023b68 + 203219a + 51f1e65 + adba36a + 48704a6 + 3ed141c + a79cdbd + 73871a0 + 47d468d + 538d0f4 + b5ad75a + 2363c4f + 91c2337 + 04dcb58 + 906c7b6 + 0da7bb6 + 0270a77 + 6784c86 + 90d950a + 3b5ea7f + 339830e + b04f4d5 + 8da9d32 + 0e2a882 + f0829e4 + c66d3bb + c44c042 + e2121f5 + 19560b1 + f08a210 + 294332a + 3ab34f5 + bb64c7d + b204532 + 1e8aff5 + da2423f + 7fce745 + 6c8026c + a449c92 + c9f86d3 + b2b0ea1 + 3b554ac + 4deeef8 + c6f5d24 + fdaf0f2 + 6047973 + 66f79d5 + ef273f8 + 6c44bc5 + ddae1cc + fc0f217 + 05d994b + 386083b + 7890c16 + 07c51ae + a62d81b + 53960c5 + 3521702 + e2fdffd + 160ad66 + 10bff24 + 944d975 + 71f09ad + 03fbbc3 + 5d527bf + 4281c0c + cc36360 + b1dde09 + e21037b + 08b1d98 + dd7c7b1 + e4fdd4c + 4ea852c + 6e89cc1 + 46b4569 + e693e44 + 0bd83de + 5dce05d + 3641177 + 226d56e + 6b82dec + 30e3679 + d702695 + e95ddeb + 6f8f3b1 + 9a73c30 + ef8261e + d9444bc + 1c0773a + e1a1f7a + 7781996 + 1524272 + 7cec1e0 + cf88eec + c11f566 + 0351056 + b5d005e + afdf14f + 94358ed + 6102afa + 1e99572 + 31681fd + 313e55d + 201b9ed + 27ee3a0 + cdbfa8a + ffed7ac + 0649e63 + dea5f03 + 73dcc77 + 5cce900 + 06d6397 + aaeffe0 + fab0f36 + 549fb43 + 299aee9 commit 6cf210f
Show file tree
Hide file tree
Showing 58 changed files with 123 additions and 278 deletions.
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
"zendframework/zend-server": "self.version",
"zendframework/zend-stdlib": "self.version"
},
"extra": {
"branch-alias": {
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
}
},
"homepage": "https://github.com/zendframework/zend-xml-rpc",
"autoload-dev": {
"psr-4": {
Expand Down
7 changes: 2 additions & 5 deletions src/AbstractValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc;
Expand All @@ -22,8 +21,6 @@
*
* Using this function, users/Zend\XmlRpc\Client object can create the Zend\XmlRpc\Value objects
* from PHP variables, XML string or by specifying the exact XML-RPC natvie type
*
* @package Zend_XmlRpc
*/
abstract class AbstractValue
{
Expand Down Expand Up @@ -257,7 +254,7 @@ public static function getXmlRpcTypeByValue($value)
return self::XMLRPC_TYPE_DOUBLE;
} elseif (is_bool($value)) {
return self::XMLRPC_TYPE_BOOLEAN;
} elseif (is_null($value)) {
} elseif (null === $value) {
return self::XMLRPC_TYPE_NIL;
} elseif (is_string($value)) {
return self::XMLRPC_TYPE_STRING;
Expand Down
7 changes: 1 addition & 6 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc;
Expand All @@ -16,10 +15,6 @@

/**
* An XML-RPC client implementation
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
*/
class Client implements ServerClient
{
Expand Down
7 changes: 1 addition & 6 deletions src/Client/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client\Exception;
Expand All @@ -14,10 +13,6 @@

/**
* Base class for all Zend_XmlRpc_Client_* exceptions
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
*/
interface ExceptionInterface extends Exception
{
Expand Down
7 changes: 1 addition & 6 deletions src/Client/Exception/FaultException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client\Exception;
Expand All @@ -14,10 +13,6 @@

/**
* Thrown by Zend_XmlRpc_Client when an XML-RPC fault response is returned.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
*/
class FaultException extends Exception\BadMethodCallException implements ExceptionInterface
{
Expand Down
7 changes: 1 addition & 6 deletions src/Client/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client\Exception;

/**
* Thrown by Zend_XmlRpc_Client when an HTTP error occurs during an
* XML-RPC method call.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
*/
class HttpException extends RuntimeException
{
Expand Down
7 changes: 1 addition & 6 deletions src/Client/Exception/IntrospectException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client\Exception;

/**
* Thrown by Zend_XmlRpc_Client_Introspection when any error occurs.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
*/
class IntrospectException extends InvalidArgumentException
{
Expand Down
3 changes: 1 addition & 2 deletions src/Client/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client\Exception;
Expand Down
3 changes: 1 addition & 2 deletions src/Client/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client\Exception;
Expand Down
10 changes: 2 additions & 8 deletions src/Client/ServerIntrospection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client;
Expand All @@ -14,10 +13,6 @@

/**
* Wraps the XML-RPC system.* introspection methods
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
*/
class ServerIntrospection
{
Expand Down Expand Up @@ -48,7 +43,7 @@ public function getSignatureForEachMethod()

try {
$signatures = $this->getSignatureForEachMethodByMulticall($methods);
} catch (FaultException $e) {
} catch (Exception\FaultException $e) {
// degrade to looping
}

Expand Down Expand Up @@ -149,5 +144,4 @@ public function listMethods()
{
return $this->system->listMethods();
}

}
7 changes: 1 addition & 6 deletions src/Client/ServerProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Client;
Expand All @@ -16,10 +15,6 @@
* The namespace decorator enables object chaining to permit
* calling XML-RPC namespaced functions like "foo.bar.baz()"
* as "$remote->foo->bar->baz()".
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Client
*/
class ServerProxy
{
Expand Down
3 changes: 1 addition & 2 deletions src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Exception;
Expand Down
7 changes: 1 addition & 6 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Exception;

/**
* @category Zend
* @package Zend_XmlRpc
*/
interface ExceptionInterface
{
}
3 changes: 1 addition & 2 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Exception;
Expand Down
3 changes: 1 addition & 2 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Exception;
Expand Down
8 changes: 1 addition & 7 deletions src/Exception/ValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc\Exception;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage Value
*/
class ValueException extends \LogicException implements ExceptionInterface
{
}
31 changes: 21 additions & 10 deletions src/Fault.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace Zend\XmlRpc;

use SimpleXMLElement;

/**
* XMLRPC Faults
*
Expand All @@ -19,9 +20,6 @@
*
* To allow method chaining, you may only use the {@link getInstance()} factory
* to instantiate a Zend_XmlRpc_Server_Fault.
*
* @category Zend
* @package Zend_XmlRpc
*/
class Fault
{
Expand Down Expand Up @@ -169,9 +167,9 @@ public function getEncoding()
* Load an XMLRPC fault from XML
*
* @param string $fault
* @return boolean Returns true if successfully loaded fault response, false
* @return bool Returns true if successfully loaded fault response, false
* if response was not a fault response
* @throws \Zend\XmlRpc\Exception\ExceptionInterface if no or faulty XML provided, or if fault
* @throws Exception\ExceptionInterface if no or faulty XML provided, or if fault
* response does not contain either code or message
*/
public function loadXml($fault)
Expand All @@ -180,12 +178,25 @@ public function loadXml($fault)
throw new Exception\InvalidArgumentException('Invalid XML provided to fault');
}

$xmlErrorsFlag = libxml_use_internal_errors(true);
try {
$xml = new \SimpleXMLElement($fault);
$xml = new SimpleXMLElement($fault);
} catch (\Exception $e) {
// Not valid XML
throw new Exception\InvalidArgumentException('Failed to parse XML fault: ' . $e->getMessage(), 500, $e);
}
if (!$xml instanceof SimpleXMLElement) {
$errors = libxml_get_errors();
$errors = array_reduce($errors, function ($result, $item) {
if (empty($result)) {
return $item->message;
}
return $result . '; ' . $item->message;
}, '');
libxml_use_internal_errors($xmlErrorsFlag);
throw new Exception\InvalidArgumentException('Failed to parse XML fault: ' . $errors, 500);
}
libxml_use_internal_errors($xmlErrorsFlag);

// Check for fault
if (!$xml->fault) {
Expand Down Expand Up @@ -235,11 +246,11 @@ public function loadXml($fault)
* Determine if an XML response is an XMLRPC fault
*
* @param string $xml
* @return boolean
* @return bool
*/
public static function isFault($xml)
{
$fault = new self();
$fault = new static();
try {
$isFault = $fault->loadXml($xml);
} catch (Exception\ExceptionInterface $e) {
Expand Down
Loading

0 comments on commit 6cf210f

Please sign in to comment.