From 52d65e1b207dd6c104d1400b3cd03e027c847911 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 4 Nov 2012 06:43:56 +0700 Subject: [PATCH 1/2] fix accident XMLRPC_TYPE_ARRAY changed to static --- src/AbstractValue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AbstractValue.php b/src/AbstractValue.php index 828969f..a429058 100644 --- a/src/AbstractValue.php +++ b/src/AbstractValue.php @@ -384,7 +384,7 @@ protected static function _xmlStringToNativeXmlRpc($xml) } if (null === $data) { - throw new Exception\ValueException('Invalid XML for XML-RPC native '. static::XMLRPC_TYPE_ARRAY .' type: ARRAY tag must contain DATA tag'); + throw new Exception\ValueException('Invalid XML for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type: ARRAY tag must contain DATA tag'); } $values = array(); // Parse all the elements of the array from the XML string From 31daaed025d35cc8c960421a0cec0239bcf90821 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 8 Nov 2012 17:21:34 +0700 Subject: [PATCH 2/2] fix self:: to static:: in others --- src/AbstractValue.php | 2 +- src/Server.php | 2 +- src/Server/Fault.php | 20 ++++++++++---------- src/Value/AbstractCollection.php | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/AbstractValue.php b/src/AbstractValue.php index a429058..36ba7fe 100644 --- a/src/AbstractValue.php +++ b/src/AbstractValue.php @@ -245,7 +245,7 @@ public static function getXmlRpcTypeByValue($value) } elseif ($value instanceof DateTime) { return self::XMLRPC_TYPE_DATETIME; } - return self::getXmlRpcTypeByValue(get_object_vars($value)); + return static::getXmlRpcTypeByValue(get_object_vars($value)); } elseif (is_array($value)) { if (!empty($value) && is_array($value) && (array_keys($value) !== range(0, count($value) - 1))) { return self::XMLRPC_TYPE_STRUCT; diff --git a/src/Server.php b/src/Server.php index 6a22434..0beb1a4 100644 --- a/src/Server.php +++ b/src/Server.php @@ -439,7 +439,7 @@ public function getResponse() */ public function setResponseClass($class) { - if (!class_exists($class) || !self::isSubclassOf($class, 'Zend\XmlRpc\Response')) { + if (!class_exists($class) || !static::isSubclassOf($class, 'Zend\XmlRpc\Response')) { throw new Server\Exception\InvalidArgumentException('Invalid response class'); } diff --git a/src/Server/Fault.php b/src/Server/Fault.php index 7ce4121..5c9b37d 100644 --- a/src/Server/Fault.php +++ b/src/Server/Fault.php @@ -58,7 +58,7 @@ public function __construct(\Exception $e) $code = 404; $message = 'Unknown error'; - foreach (array_keys(self::$faultExceptionClasses) as $class) { + foreach (array_keys(static::$faultExceptionClasses) as $class) { if ($e instanceof $class) { $code = $e->getCode(); $message = $e->getMessage(); @@ -69,8 +69,8 @@ public function __construct(\Exception $e) parent::__construct($code, $message); // Notify exception observers, if present - if (!empty(self::$observers)) { - foreach (array_keys(self::$observers) as $observer) { + if (!empty(static::$observers)) { + foreach (array_keys(static::$observers) as $observer) { $observer::observe($this); } } @@ -101,7 +101,7 @@ public static function attachFaultException($classes) foreach ($classes as $class) { if (is_string($class) && class_exists($class)) { - self::$faultExceptionClasses[$class] = true; + static::$faultExceptionClasses[$class] = true; } } } @@ -119,8 +119,8 @@ public static function detachFaultException($classes) } foreach ($classes as $class) { - if (is_string($class) && isset(self::$faultExceptionClasses[$class])) { - unset(self::$faultExceptionClasses[$class]); + if (is_string($class) && isset(static::$faultExceptionClasses[$class])) { + unset(static::$faultExceptionClasses[$class]); } } } @@ -146,8 +146,8 @@ public static function attachObserver($class) return false; } - if (!isset(self::$observers[$class])) { - self::$observers[$class] = true; + if (!isset(static::$observers[$class])) { + static::$observers[$class] = true; } return true; @@ -161,11 +161,11 @@ public static function attachObserver($class) */ public static function detachObserver($class) { - if (!isset(self::$observers[$class])) { + if (!isset(static::$observers[$class])) { return false; } - unset(self::$observers[$class]); + unset(static::$observers[$class]); return true; } diff --git a/src/Value/AbstractCollection.php b/src/Value/AbstractCollection.php index fcade4c..b3140e6 100644 --- a/src/Value/AbstractCollection.php +++ b/src/Value/AbstractCollection.php @@ -32,7 +32,7 @@ public function __construct($value) // If the elements of the given array are not Zend_XmlRpc_Value objects, // we need to convert them as such (using auto-detection from PHP value) if (!$value instanceof parent) { - $value = self::getXmlRpcValue($value, self::AUTO_DETECT_TYPE); + $value = static::getXmlRpcValue($value, self::AUTO_DETECT_TYPE); } $this->value[$key] = $value; }