ZF-1858: Zend_XmlRpc_Server should implement Zend_Server_Interface
Description
Changing "public function handle(Zend_XmlRpc_Request $request = null)" to "public function handle($request = null)" is not critical, because type checking is also done by the following setRequest call. The other changes also don't seem to cause problems.
Patch follows:
Index: Zend/XmlRpc/Server.php
===================================================================
--- Zend/XmlRpc/Server.php (revision 6103)
+++ Zend/XmlRpc/Server.php (working copy)
@@ -112,7 +112,7 @@
* @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
*/
-class Zend_XmlRpc_Server
+class Zend_XmlRpc_Server implements Zend_Server_Interface
{
/**
* Character encoding
@@ -368,7 +368,7 @@
* @param mixed $class
* @return void
*/
- public function setPersistence($class = null)
+ public function setPersistence($class)
{
}
@@ -447,7 +447,7 @@
* @param int $code
* @return Zend_XmlRpc_Server_Fault
*/
- public function fault($fault, $code = 404)
+ public function fault($fault = null, $code = 404)
{
if (!$fault instanceof Exception) {
$fault = (string) $fault;
@@ -544,7 +544,7 @@
* @param Zend_XmlRpc_Request $request Optional
* @return Zend_XmlRpc_Response|Zend_XmlRpc_Fault
*/
- public function handle(Zend_XmlRpc_Request $request = null)
+ public function handle($request = null)
{
// Get request
if ((null === $request) && (null === ($request = $this->getRequest()))) {
@@ -726,3 +726,4 @@
return $responses;
}
}
Comments
Posted by Thomas Weidner (thomas) on 2007-08-16T13:21:24.000+0000
Assigned to Matthew
Posted by Matthew Weier O'Phinney (matthew) on 2007-11-16T15:12:42.000+0000
I was against Zend_Server_Interface from the beginning, because it does not allow for type hinting, which would make implementations such as Zend_XmlRpc_Server (which predated Zend_Server_Interface) more complex (explicit checks in the code, instead of implicit checks via type hinting).
Won't fix.
Posted by Lars Strojny (lars) on 2007-11-19T07:03:28.000+0000
Aeh, what? Your opinion is fine. But as the other components implement this interface, don't you think it is a really good idea to implement that in Zend_XmlRpc_Server too? Just for the sake of completeness. And yes, you are right, the type hinting thing is pretty sad, but at the end it is a PHP fault (see http://bugs.php.net/bug.php?id=37854). Not implementing Zend_Server_Interface in Zend_XmlRpc_Server would erase the possibility to have type-hinting for a consumer of Zend_Server-implementations. I think this is a valuable argument.
Posted by Matthew Weier O'Phinney (matthew) on 2008-04-22T11:24:14.000+0000
Scheduling for next minor release.
Posted by Matthew Weier O'Phinney (matthew) on 2008-08-05T09:05:43.000+0000
Changes commited to trunk in r10683 and merged to 1.6 release branch in r10684.
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:14.000+0000
Updating for the 1.6.0 release.