*\r
* @version $Id: xmlrpc_wrappers.inc,v 1.13 2008/09/20 01:23:47 ggiunta Exp $\r
* @author Gaetano Giunta\r
- * @copyright (C) 2006-2008 G. Giunta\r
+ * @copyright (C) 2006-2009 G. Giunta\r
* @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt\r
*\r
* @todo separate introspection from code generation for func-2-method wrapping\r
* accepted come from javadoc blocks), return corresponding phpxmlrpc type.\r
* NB: for php 'resource' types returns empty string, since resources cannot be serialized;\r
* for php class names returns 'struct', since php objects can be serialized as xmlrpc structs\r
+ * for php arrays always return array, even though arrays sometiles serialize as json structs\r
* @param string $phptype\r
* @return string\r
*/\r
}\r
\r
$exists = false;\r
+ if (is_string($funcname) && strpos($funcname, '::') !== false)\r
+ {\r
+ $funcname = explode('::', $funcname);\r
+ }\r
if(is_array($funcname))\r
{\r
if(count($funcname) < 2 || (!is_string($funcname[0]) && !is_object($funcname[0])))\r
$plainfuncname = get_class($funcname[0]) . '->' . $funcname[1];\r
}\r
$exists = method_exists($funcname[0], $funcname[1]);\r
+ if (!$exists && version_compare(phpversion(), '5.1') < 0)\r
+ {\r
+ // workaround for php 5.0: static class methods are not seen by method_exists\r
+ $exists = is_callable( $funcname );\r
+ }\r
}\r
else\r
{\r
// start to introspect PHP code\r
if(is_array($funcname))\r
{\r
- $func =& new ReflectionMethod($funcname[0], $funcname[1]);\r
+ $func = new ReflectionMethod($funcname[0], $funcname[1]);\r
if($func->isPrivate())\r
{\r
error_log('XML-RPC: method to be wrapped is private: '.$plainfuncname);\r
error_log('XML-RPC: method to be wrapped is the constructor: '.$plainfuncname);\r
return false;\r
}\r
- if($func->isDestructor())\r
+ // php 503 always says isdestructor = true...\r
+ if( version_compare(phpversion(), '5.0.3') != 0 && $func->isDestructor())\r
{\r
error_log('XML-RPC: method to be wrapped is the destructor: '.$plainfuncname);\r
return false;\r
}\r
else\r
{\r
- $func =& new ReflectionFunction($funcname);\r
+ $func = new ReflectionFunction($funcname);\r
}\r
if($func->isInternal())\r
{\r
if ($methodfilter == '' || preg_match($methodfilter, $mname))\r
{\r
// echo $mlist."\n";\r
- $func =& new ReflectionMethod($classname, $mname);\r
+ $func = new ReflectionMethod($classname, $mname);\r
if(!$func->isPrivate() && !$func->isProtected() && !$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract())\r
{\r
if(($func->isStatic && ($methodtype == 'all' || $methodtype == 'static' || ($methodtype == 'auto' && is_string($classname)))) ||\r
$valclass = $prefix.'val';\r
$decodefunc = 'php_'.$prefix.'_decode';\r
\r
- $msg =& new $msgclass('system.methodSignature');\r
+ $msg = new $msgclass('system.methodSignature');\r
$msg->addparam(new $valclass($methodname));\r
$client->setDebug($debug);\r
$response =& $client->send($msg, $timeout, $protocol);\r
// in online mode, favour speed of operation\r
if(!$buildit)\r
{\r
- $msg =& new $msgclass('system.methodHelp');\r
+ $msg = new $msgclass('system.methodHelp');\r
$msg->addparam(new $valclass($methodname));\r
$response =& $client->send($msg, $timeout, $protocol);\r
if (!$response->faultCode())\r
//$valclass = $prefix.'val';\r
$decodefunc = 'php_'.$prefix.'_decode';\r
\r
- $msg =& new $msgclass('system.listMethods');\r
+ $msg = new $msgclass('system.listMethods');\r
$response =& $client->send($msg, $timeout, $protocol);\r
if($response->faultCode())\r
{\r
$innercode = '';\r
$this_ = 'this->';\r
}\r
- $innercode .= "\$msg =& new {$prefix}msg('$methodname');\n";\r
+ $innercode .= "\$msg = new {$prefix}msg('$methodname');\n";\r
\r
if ($mdesc != '')\r
{\r
$ptype == 'string' || $ptype == 'dateTime.iso8601' || $ptype == 'base64' || $ptype == 'null')\r
{\r
// only build directly xmlrpcvals when type is known and scalar\r
- $innercode .= "\$p$i =& new {$prefix}val(\$p$i, '$ptype');\n";\r
+ $innercode .= "\$p$i = new {$prefix}val(\$p$i, '$ptype');\n";\r
}\r
else\r
{\r
*/\r
function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc')\r
{\r
- $code = "\$client =& new {$prefix}_client('".str_replace("'", "\'", $client->path).\r
+ $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path).\r
"', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";\r
\r
// copy all client fields to the client that will be generated runtime\r