- improve compatibility with php 5.0.x
[plcapi.git] / lib / xmlrpc_wrappers.inc
index f96edd5..d4099f2 100644 (file)
                }\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
                                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