X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2FWrapper.php;h=6529950c9a3c24d817fc8689c3783244d0278934;hb=a5da33dc74d339b73996a566fefd59336d44b295;hp=2c0d1f78259ed1cc17b1e05154c444d4f36a5a20;hpb=4a96cc50a093dca5e40b78531b1efa8fa5ee7852;p=plcapi.git diff --git a/src/Wrapper.php b/src/Wrapper.php index 2c0d1f7..6529950 100644 --- a/src/Wrapper.php +++ b/src/Wrapper.php @@ -18,6 +18,9 @@ namespace PhpXmlRpc; */ class Wrapper { + /// used to hold a reference to object instances whose methods get wrapped by wrap_php_function(), in 'create source' mode + public static $objHolder = array(); + /** * Given a string defining a php type or phpxmlrpc type (loosely defined: strings * accepted come from javadoc blocks), return corresponding phpxmlrpc type. @@ -541,10 +544,10 @@ class Wrapper $innerCode .= "\$np = false;\n"; // since we are building source code for later use, if we are given an object instance, - // we go out of our way and store a pointer to it in a global var... + // we go out of our way and store a pointer to it in a static class var var... if (is_array($callable) && is_object($callable[0])) { - $GLOBALS['xmlrpcWPFObjHolder'][$newFuncName] = &$callable[0]; - $innerCode .= "\$obj =& \$GLOBALS['xmlrpcWPFObjHolder']['$newFuncName'];\n"; + self::$objHolder[$newFuncName] = $callable[0]; + $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n"; $realFuncName = '$obj->' . $callable[1]; } else { $realFuncName = $plainFuncName; @@ -777,6 +780,8 @@ class Wrapper * @param array $extraOptions * @param string $mSig * @return callable + * + * @todo should we allow usage of parameter simple_client_copy to mean 'do not clone' in this case? */ protected function buildWrapMethodClosure($client, $methodName, array $extraOptions, $mSig) {