Skip to content

Commit dcea639

Browse files
authored
Revert "Merge commit from fork" (#5825)
This reverts commit 453fb73.
1 parent 453fb73 commit dcea639

File tree

1 file changed

+23
-43
lines changed

1 file changed

+23
-43
lines changed

main/inc/lib/nusoap/class.soap_server.php

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -586,54 +586,34 @@ function invoke_method() {
586586
$this->appendDebug($this->varDump($this->methodparams));
587587
$this->debug("in invoke_method, calling '$this->methodname'");
588588
if (!function_exists('call_user_func_array')) {
589-
try {
590-
if ($class == '') {
591-
$this->debug('in invoke_method, calling function using eval()');
592-
$reflectionFunction = new ReflectionFunction($this->methodname);
593-
$params = $reflectionFunction->getParameters();
594-
595-
if (count($params) !== count($this->methodparams)) {
596-
$this->fault('SOAP-ENV:Client', "Paremeter count mismatch");
597-
return;
598-
}
599-
600-
$this->methodreturn = $reflectionFunction->invokeArgs(array_values($this->methodparams));
589+
if ($class == '') {
590+
$this->debug('in invoke_method, calling function using eval()');
591+
$funcCall = "\$this->methodreturn = $this->methodname(";
592+
} else {
593+
if ($delim == '..') {
594+
$this->debug('in invoke_method, calling class method using eval()');
595+
$funcCall = "\$this->methodreturn = ".$class."::".$method."(";
601596
} else {
602-
$reflectionMethod = new ReflectionMethod($class, $method);
603-
$params = $reflectionMethod->getParameters();
604-
605-
if (count($params) !== count($this->methodparams)) {
606-
$this->fault('SOAP-ENV:Client', "Paremeter count mismatch");
597+
$this->debug('in invoke_method, calling instance method using eval()');
598+
// generate unique instance name
599+
$instname = "\$inst_".time();
600+
$funcCall = $instname." = new ".$class."(); ";
601+
$funcCall .= "\$this->methodreturn = ".$instname."->".$method."(";
602+
}
603+
}
604+
if ($this->methodparams) {
605+
foreach ($this->methodparams as $param) {
606+
if (is_array($param) || is_object($param)) {
607+
$this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available');
607608
return;
608609
}
609-
610-
$instance = null;
611-
612-
if ($delim == '..') {
613-
if (!$reflectionMethod->isStatic()) {
614-
throw new Exception("Method '$method' is not static");
615-
}
616-
} else {
617-
if ($reflectionMethod->isStatic()) {
618-
throw new Exception("Method '$method' is static");
619-
}
620-
621-
$instance = new $class();
622-
}
623-
624-
$this->methodreturn = $reflectionMethod->invokeArgs($instance, array_values($this->methodparams));
610+
$funcCall .= "\"$param\",";
625611
}
626-
627-
$this->debug('in invoke_method, methodreturn: ' . $this->varDump($this->methodreturn));
628-
} catch (ReflectionException $e) {
629-
$this->fault('SOAP-ENV:Client', 'Error invoking method: '.$e->getMessage());
630-
631-
return;
632-
} catch (Exception $e) {
633-
$this->fault('SOAP-ENV:Client', $e->getMessage());
634-
635-
return;
612+
$funcCall = substr($funcCall, 0, -1);
636613
}
614+
$funcCall .= ');';
615+
$this->debug('in invoke_method, function call: '.$funcCall);
616+
@eval($funcCall);
637617
} else {
638618
if ($class == '') {
639619
$this->debug('in invoke_method, calling function using call_user_func_array()');

0 commit comments

Comments
 (0)