Bump requirements to 5.1.0; grammar fixes in comments
[plcapi.git] / lib / xmlrpc_wrappers.inc
index 9ca5750..1fbf5ce 100644 (file)
@@ -3,9 +3,8 @@
  * PHP-XMLRPC "wrapper" functions\r
  * Generate stubs to transparently access xmlrpc methods as php functions and viceversa\r
  *\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-2009 G. Giunta\r
+ * @copyright (C) 2006-2014 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
@@ -22,6 +21,7 @@
        * 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
        * carried out by the lib, while datetime vals are passed around as strings)\r
        *\r
        * Known limitations:\r
-       * - requires PHP 5.0.3 +\r
        * - only works for user-defined functions, not for PHP internal functions\r
        *   (reflection does not support retrieving number/type of params for those)\r
        * - functions returning php objects will generate special xmlrpc responses:\r
                $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false;\r
                $catch_warnings = isset($extra_options['suppress_warnings']) && $extra_options['suppress_warnings'] ? '@' : '';\r
 \r
-               if(version_compare(phpversion(), '5.0.3') == -1)\r
-               {\r
-                       // up to php 5.0.3 some useful reflection methods were missing\r
-                       error_log('XML-RPC: cannot not wrap php functions unless running php version bigger than 5.0.3');\r
-                       return false;\r
-               }\r
-\r
-        $exists = false;\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
                                error_log('XML-RPC: method to be wrapped is the constructor: '.$plainfuncname);\r
                                return false;\r
                        }\r
-                       if($func->isDestructor())\r
+                if($func->isDestructor())\r
                        {\r
                                error_log('XML-RPC: method to be wrapped is the destructor: '.$plainfuncname);\r
                                return false;\r
                $methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : '';\r
                $methodtype = isset($extra_options['method_type']) ? $extra_options['method_type'] : 'auto';\r
 \r
-        if(version_compare(phpversion(), '5.0.3') == -1)\r
-               {\r
-                       // up to php 5.0.3 some useful reflection methods were missing\r
-                       error_log('XML-RPC: cannot not wrap php functions unless running php version bigger than 5.0.3');\r
-                       return false;\r
-               }\r
-\r
         $result = array();\r
                $mlist = get_class_methods($classname);\r
                foreach($mlist as $mname)\r