diff --git a/phpgwapi/inc/class.xmlrpc_server.inc.php b/phpgwapi/inc/class.xmlrpc_server.inc.php index e7f9938fee..4e9b7fe959 100644 --- a/phpgwapi/inc/class.xmlrpc_server.inc.php +++ b/phpgwapi/inc/class.xmlrpc_server.inc.php @@ -186,10 +186,10 @@ function build_resp($_res,$recursed=False) { - if(is_array($_res)) + if (is_array($_res)) { @reset($_res); - while(list($key,$val) = @each($_res)) + while (list($key,$val) = @each($_res)) { $ele[$key] = $this->build_resp($val,True); } @@ -197,14 +197,30 @@ } else { - $_type = (is_long($_res)?'int':gettype($_res)); - if($recursed) + $_type = (is_integer($_res)?'int':gettype($_res)); + if ($recursed) { - return CreateObject('phpgwapi.xmlrpcval',$_res,$_type); + // Passing an integer of 0 to the xmlrpcval constructor results in the value being lost. (jengo) + if ($_type == 'int' && $_res == 0) + { + return CreateObject('phpgwapi.xmlrpcval','0',$_type); + } + else + { + return CreateObject('phpgwapi.xmlrpcval',$_res,$_type); + } } else { - $this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval',$_res,$_type); + // Passing an integer of 0 to the xmlrpcval constructor results in the value being lost. (jengo) + if ($_type == 'int' && $_res == 0) + { + $this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval','0',$_type); + } + else + { + $this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval',$_res,$_type); + } } } } @@ -311,7 +327,7 @@ } else { - if (function_exists($dmap[$methName]['function'])) + if(function_exists($dmap[$methName]['function'])) { $code = '$r =' . $dmap[$methName]['function'] . '($m);'; $code = ereg_replace(',,',",'',",$code); @@ -319,35 +335,31 @@ } else { - // phpgw mod - finally, execute the function call and return the values + /* phpgw mod - finally, execute the function call and return the values */ $params = $GLOBALS['_xh'][$parser]['params'][0]; $code = '$p = ' . $params . ';'; - if ($code != '$p = ;') - { - eval($code); - $params = $p->getval(); - } + eval($code); + $params = $p->getval(); // _debug_array($params); - //$this->reqtoarray($params); + $this->reqtoarray($params); //_debug_array($this->req_array); - if (ereg('^service',$method)) + if(ereg('^service',$method)) { $res = ExecMethod('phpgwapi.service.exec',array($service,$methName,$this->req_array)); } else { -// $res = ExecMethod($method,$this->req_array); - $r = ExecMethod($method,$params); + $res = ExecMethod($method,$this->req_array); } - - // _debug_array($res);exit; + /* $res = ExecMethod($method,$params); */ + /* _debug_array($res);exit; */ $this->resp_struct = array(); $this->build_resp($res); - //_debug_array($this->resp_struct); + /*_debug_array($this->resp_struct); */ @reset($this->resp_struct); -// $r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->resp_struct,'struct')); - // _debug_array($r); + $r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->resp_struct,'struct')); + /* _debug_array($r); */ } } } diff --git a/phpgwapi/inc/class.xmlrpcval.inc.php b/phpgwapi/inc/class.xmlrpcval.inc.php index d15b6f2797..0754ed89a0 100644 --- a/phpgwapi/inc/class.xmlrpcval.inc.php +++ b/phpgwapi/inc/class.xmlrpcval.inc.php @@ -23,11 +23,12 @@ var $me = array(); var $mytype = 0; - function xmlrpcval($val=-1, $type='') + function xmlrpcval($val = -1, $type = '') { $this->me = array(); $this->mytype = 0; - if ($val!=-1 || $type!='') + + if ($val != -1 || $type != '') { if ($type=='') {