git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4a96cc5
)
Remove usage of one global var in favor of static class var
author
gggeek
<giunta.gaetano@gmail.com>
Sat, 23 May 2015 18:57:34 +0000
(19:57 +0100)
committer
gggeek
<giunta.gaetano@gmail.com>
Sat, 23 May 2015 18:57:34 +0000
(19:57 +0100)
src/Wrapper.php
patch
|
blob
|
history
diff --git
a/src/Wrapper.php
b/src/Wrapper.php
index
2c0d1f7
..
6529950
100644
(file)
--- a/
src/Wrapper.php
+++ b/
src/Wrapper.php
@@
-18,6
+18,9
@@
namespace PhpXmlRpc;
*/
class Wrapper
{
*/
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.
/**
* 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,
$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])) {
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;
$realFuncName = '$obj->' . $callable[1];
} else {
$realFuncName = $plainFuncName;
@@
-777,6
+780,8
@@
class Wrapper
* @param array $extraOptions
* @param string $mSig
* @return callable
* @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)
{
*/
protected function buildWrapMethodClosure($client, $methodName, array $extraOptions, $mSig)
{