import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -26,18 +26,6 @@
*/
require_once 'Zend/Http/Client.php';
/**
* Exception thrown when an HTTP error occurs
* @see Zend_XmlRpc_Client_HttpException
*/
require_once 'Zend/XmlRpc/Client/HttpException.php';
/**
* Exception thrown when an XML-RPC fault is returned
* @see Zend_XmlRpc_Client_FaultException
*/
require_once 'Zend/XmlRpc/Client/FaultException.php';
/**
* Enables object chaining for calling namespaced XML-RPC methods.
* @see Zend_XmlRpc_Client_ServerProxy
@ -236,8 +224,8 @@ class Zend_XmlRpc_Client
/**
* Set skip system lookup flag
*
* @param bool $flag
*
* @param bool $flag
* @return Zend_XmlRpc_Client
*/
public function setSkipSystemLookup($flag = true)
@ -248,7 +236,7 @@ class Zend_XmlRpc_Client
/**
* Skip system lookup when determining if parameter should be array or struct?
*
*
* @return bool
*/
public function skipSystemLookup()
@ -262,6 +250,7 @@ class Zend_XmlRpc_Client
* @param Zend_XmlRpc_Request $request
* @param null|Zend_XmlRpc_Response $response
* @return void
* @throws Zend_XmlRpc_Client_HttpException
*/
public function doRequest($request, $response = null)
{
@ -287,6 +276,11 @@ class Zend_XmlRpc_Client
$httpResponse = $http->request(Zend_Http_Client::POST);
if (! $httpResponse->isSuccessful()) {
/**
* Exception thrown when an HTTP error occurs
* @see Zend_XmlRpc_Client_HttpException
*/
require_once 'Zend/XmlRpc/Client/HttpException.php';
throw new Zend_XmlRpc_Client_HttpException(
$httpResponse->getMessage(),
$httpResponse->getStatus());
@ -302,9 +296,10 @@ class Zend_XmlRpc_Client
/**
* Send an XML-RPC request to the service (for a specific method)
*
* @param string $method Name of the method we want to call
* @param array $params Array of parameters for the method
* @throws Zend_Http_Client_FaultException
* @param string $method Name of the method we want to call
* @param array $params Array of parameters for the method
* @return mixed
* @throws Zend_XmlRpc_Client_FaultException
*/
public function call($method, $params=array())
{
@ -332,10 +327,10 @@ class Zend_XmlRpc_Client
}
}
$params[$key] = array(
'type' => $type,
'type' => $type,
'value' => $param
);
}
}
}
}
}
@ -346,6 +341,11 @@ class Zend_XmlRpc_Client
if ($this->_lastResponse->isFault()) {
$fault = $this->_lastResponse->getFault();
/**
* Exception thrown when an XML-RPC fault is returned
* @see Zend_XmlRpc_Client_FaultException
*/
require_once 'Zend/XmlRpc/Client/FaultException.php';
throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(),
$fault->getCode());
}

View File

@ -19,11 +19,6 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_XmlRpc_Client_IntrospectException */
require_once 'Zend/XmlRpc/Client/IntrospectException.php';
/**
* Wraps the XML-RPC system.* introspection methods
*
@ -60,6 +55,7 @@ class Zend_XmlRpc_Client_ServerIntrospection
{
$methods = $this->listMethods();
require_once 'Zend/XmlRpc/Client/FaultException.php';
try {
$signatures = $this->getSignatureForEachMethodByMulticall($methods);
} catch (Zend_XmlRpc_Client_FaultException $e) {
@ -98,11 +94,13 @@ class Zend_XmlRpc_Client_ServerIntrospection
if (! is_array($serverSignatures)) {
$type = gettype($serverSignatures);
$error = "Multicall return is malformed. Expected array, got $type";
require_once 'Zend/XmlRpc/Client/IntrospectException.php';
throw new Zend_XmlRpc_Client_IntrospectException($error);
}
if (count($serverSignatures) != count($methods)) {
$error = 'Bad number of signatures received from multicall';
require_once 'Zend/XmlRpc/Client/IntrospectException.php';
throw new Zend_XmlRpc_Client_IntrospectException($error);
}

View File

@ -23,11 +23,6 @@
*/
require_once 'Zend/XmlRpc/Value.php';
/**
* Zend_XmlRpc_Exception
*/
require_once 'Zend/XmlRpc/Exception.php';
/**
* XMLRPC Faults
*
@ -197,6 +192,7 @@ class Zend_XmlRpc_Fault
public function loadXml($fault)
{
if (!is_string($fault)) {
require_once 'Zend/XmlRpc/Exception.php';
throw new Zend_XmlRpc_Exception('Invalid XML provided to fault');
}
@ -204,6 +200,7 @@ class Zend_XmlRpc_Fault
$xml = @new SimpleXMLElement($fault);
} catch (Exception $e) {
// Not valid XML
require_once 'Zend/XmlRpc/Exception.php';
throw new Zend_XmlRpc_Exception('Failed to parse XML fault: ' . $e->getMessage(), 500);
}
@ -215,6 +212,7 @@ class Zend_XmlRpc_Fault
if (!$xml->fault->value->struct) {
// not a proper fault
require_once 'Zend/XmlRpc/Exception.php';
throw new Zend_XmlRpc_Exception('Invalid fault structure', 500);
}
@ -231,6 +229,7 @@ class Zend_XmlRpc_Fault
}
if (empty($code) && empty($message)) {
require_once 'Zend/XmlRpc/Exception.php';
throw new Zend_XmlRpc_Exception('Fault code and string required');
}
@ -261,6 +260,7 @@ class Zend_XmlRpc_Fault
public static function isFault($xml)
{
$fault = new self();
require_once 'Zend/XmlRpc/Exception.php';
try {
$isFault = $fault->loadXml($xml);
} catch (Zend_XmlRpc_Exception $e) {

View File

@ -18,11 +18,6 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Zend_XmlRpc_Exception
*/
require_once 'Zend/XmlRpc/Exception.php';
/**
* Zend_XmlRpc_Value
*/
@ -48,7 +43,7 @@ require_once 'Zend/XmlRpc/Fault.php';
* @package Zend_XmlRpc
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Request.php 8997 2008-03-22 17:17:05Z matthew $
* @version $Id: Request.php 13223 2008-12-14 11:21:31Z thomas $
*/
class Zend_XmlRpc_Request
{
@ -285,7 +280,7 @@ class Zend_XmlRpc_Request
/**
* Return parameter types
*
*
* @return array
*/
public function getTypes()

View File

@ -17,7 +17,7 @@
* @subpackage Server
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Server.php 12195 2008-10-30 13:34:35Z matthew $
* @version $Id: Server.php 13223 2008-12-14 11:21:31Z thomas $
*/
/**
@ -25,11 +25,6 @@
*/
require_once 'Zend/Server/Abstract.php';
/**
* Exception this class throws
*/
require_once 'Zend/XmlRpc/Server/Exception.php';
/**
* XMLRPC Request
*/
@ -190,9 +185,9 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
/**
* Proxy calls to system object
*
* @param string $method
* @param array $params
*
* @param string $method
* @param array $params
* @return mixed
* @throws Zend_XmlRpc_Server_Exception
*/
@ -200,6 +195,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
{
$system = $this->getSystem();
if (!method_exists($system, $method)) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Unknown instance method called on server: ' . $method);
}
return call_user_func_array(array($system, $method), $params);
@ -224,6 +220,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
public function addFunction($function, $namespace = '')
{
if (!is_string($function) && !is_array($function)) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Unable to attach function; invalid', 611);
}
@ -236,6 +233,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
$function = (array) $function;
foreach ($function as $func) {
if (!is_string($func) || !function_exists($func)) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Unable to attach function; invalid', 611);
}
$reflection = Zend_Server_Reflection::reflectFunction($func, $argv, $namespace);
@ -264,6 +262,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
{
if (is_string($class) && !class_exists($class)) {
if (!class_exists($class)) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Invalid method class', 610);
}
}
@ -294,6 +293,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
if (empty($fault)) {
$fault = 'Unknown error';
}
require_once 'Zend/XmlRpc/Server/Exception.php';
$fault = new Zend_XmlRpc_Server_Exception($fault, $code);
}
@ -353,6 +353,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
} else {
$type = gettype($definition);
}
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Unable to load server definition; must be an array or Zend_Server_Definition, received ' . $type, 612);
}
@ -415,10 +416,12 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
if (is_string($request) && class_exists($request)) {
$request = new $request();
if (!$request instanceof Zend_XmlRpc_Request) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Invalid request class');
}
$request->setEncoding($this->getEncoding());
} elseif (!$request instanceof Zend_XmlRpc_Request) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Invalid request object');
}
@ -457,7 +460,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
/**
* Retrieve current response class
*
*
* @return string
*/
public function getResponseClass()
@ -467,7 +470,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
/**
* Retrieve dispatch table
*
*
* @return array
*/
public function getDispatchTable()
@ -490,7 +493,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
/**
* Retrieve system object
*
*
* @return Zend_XmlRpc_Server_System
*/
public function getSystem()
@ -500,8 +503,8 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
/**
* Map PHP type to XML-RPC type
*
* @param string $type
*
* @param string $type
* @return string
*/
protected function _fixType($type)
@ -527,6 +530,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
// Check for valid method
if (!$this->_table->hasMethod($method)) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 620);
}
@ -559,6 +563,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
}
}
if (!$matched) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Calling parameters do not match signature', 623);
}
@ -569,7 +574,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
/**
* Register system methods with the server
*
*
* @return void
*/
protected function _registerSystemMethods()

View File

@ -31,6 +31,11 @@
*/
class Zend_XmlRpc_Server_System
{
/**
* @var Zend_XmlRpc_Server
*/
protected $_server;
/**
* Constructor
*

View File

@ -17,13 +17,9 @@
* @subpackage Value
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Value.php 9095 2008-03-30 18:52:31Z thomas $
* @version $Id: Value.php 13223 2008-12-14 11:21:31Z thomas $
*/
/** Zend_XmlRpc_Value_Exception */
require_once 'Zend/XmlRpc/Value/Exception.php';
/** Zend_XmlRpc_Value_Scalar */
require_once 'Zend/XmlRpc/Value/Scalar.php';
@ -57,7 +53,6 @@ require_once 'Zend/XmlRpc/Value/Array.php';
/** Zend_XmlRpc_Value_Struct */
require_once 'Zend/XmlRpc/Value/Struct.php';
/**
* Represent a native XML-RPC value entity, used as parameters for the methods
* called by the Zend_XmlRpc_Client object and as the return value for those calls.
@ -227,6 +222,7 @@ abstract class Zend_XmlRpc_Value
return new Zend_XmlRpc_Value_Struct($value);
default:
require_once 'Zend/XmlRpc/Value/Exception.php';
throw new Zend_XmlRpc_Value_Exception('Given type is not a '. __CLASS__ .' constant');
}
}
@ -248,7 +244,7 @@ abstract class Zend_XmlRpc_Value
if ($value instanceof Zend_XmlRpc_Value) {
return $value;
}
// Otherwise, we convert the object into a struct
$value = get_object_vars($value);
// Break intentionally omitted
@ -300,6 +296,7 @@ abstract class Zend_XmlRpc_Value
$simple_xml = @new SimpleXMLElement($simple_xml);
} catch (Exception $e) {
// The given string is not a valid XML
require_once 'Zend/XmlRpc/Value/Exception.php';
throw new Zend_XmlRpc_Value_Exception('Failed to create XML-RPC value from XML string: '.$e->getMessage(),$e->getCode());
}
}
@ -338,10 +335,11 @@ abstract class Zend_XmlRpc_Value
case self::XMLRPC_TYPE_ARRAY:
// If the XML is valid, $value must be an SimpleXML element and contain the <data> tag
if (!$value instanceof SimpleXMLElement) {
require_once 'Zend/XmlRpc/Value/Exception.php';
throw new Zend_XmlRpc_Value_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type');
}
}
// PHP 5.2.4 introduced a regression in how empty($xml->value)
// PHP 5.2.4 introduced a regression in how empty($xml->value)
// returns; need to look for the item specifically
$data = null;
foreach ($value->children() as $key => $value) {
@ -350,8 +348,9 @@ abstract class Zend_XmlRpc_Value
break;
}
}
if (null === $data) {
require_once 'Zend/XmlRpc/Value/Exception.php';
throw new Zend_XmlRpc_Value_Exception('Invalid XML for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type: ARRAY tag must contain DATA tag');
}
$values = array();
@ -365,6 +364,7 @@ abstract class Zend_XmlRpc_Value
case self::XMLRPC_TYPE_STRUCT:
// If the XML is valid, $value must be an SimpleXML
if ((!$value instanceof SimpleXMLElement)) {
require_once 'Zend/XmlRpc/Value/Exception.php';
throw new Zend_XmlRpc_Value_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_STRUCT .' type');
}
$values = array();
@ -373,7 +373,7 @@ abstract class Zend_XmlRpc_Value
foreach ($value->member as $member) {
// @todo? If a member doesn't have a <value> tag, we don't add it to the struct
// Maybe we want to throw an exception here ?
if ((!$member->value instanceof SimpleXMLElement) || empty($member->value)) {
if ((!$member->value instanceof SimpleXMLElement)) {
continue;
//throw new Zend_XmlRpc_Value_Exception('Member of the '. self::XMLRPC_TYPE_STRUCT .' XML-RPC native type must contain a VALUE tag');
}
@ -382,6 +382,7 @@ abstract class Zend_XmlRpc_Value
$xmlrpc_val = new Zend_XmlRpc_Value_Struct($values);
break;
default:
require_once 'Zend/XmlRpc/Value/Exception.php';
throw new Zend_XmlRpc_Value_Exception('Value type \''. $type .'\' parsed from the XML string is not a known XML-RPC native type');
break;
}