Finally fix return values, I hope

This commit is contained in:
Miles Lott 2001-12-06 15:51:06 +00:00
parent 6d507464c0
commit 60e82152d5
5 changed files with 32 additions and 29 deletions

View File

@ -198,13 +198,13 @@
if (!$r->faultCode()) if (!$r->faultCode())
{ {
$this->debug('<hr>I got this value back<br><pre>' . htmlentities($r->serialize()) . '</pre><hr>',$debug); $this->debug('<hr>I got this value back<br><pre>' . htmlentities($r->serialize()) . '</pre><hr>',$debug);
$this->result = xmlrpc_decode($v);
} }
else else
{ {
$this->debug('Fault Code: ' . $r->faultCode() . ' Reason "' . $r->faultString() . '"<br>',$debug); $this->debug('Fault Code: ' . $r->faultCode() . ' Reason "' . $r->faultString() . '"<br>',$debug);
$this->result = htmlentities($r->serialize());
} }
$this->result = xmlrpc_decode($v);
return $this->result; return $this->result;
} }
@ -251,13 +251,13 @@
if (!$r->faultCode()) if (!$r->faultCode())
{ {
$this->debug('<hr>I got this value back<br><pre>' . htmlentities($r->serialize()) . '</pre><hr>',$debug); $this->debug('<hr>I got this value back<br><pre>' . htmlentities($r->serialize()) . '</pre><hr>',$debug);
$this->result = xmlrpc_decode($v);
} }
else else
{ {
$this->debug('Fault Code: ' . $r->faultCode() . ' Reason "' . $r->faultString() . '"<br>',$debug); $this->debug('Fault Code: ' . $r->faultCode() . ' Reason "' . $r->faultString() . '"<br>',$debug);
$this->result = htmlentities($r->serialize());
} }
$this->result = xmlrpc_decode($v);
return $this->result; return $this->result;
} }

View File

@ -122,12 +122,13 @@
} }
if (!$fp) if (!$fp)
{ {
return CreateObject( $r = CreateObject(
'phpgwapi.xmlrpcresp', 'phpgwapi.xmlrpcresp',
0, '',
$GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcerr']['http_error'],
$GLOBALS['xmlrpcstr']['http_error'] $GLOBALS['xmlrpcstr']['http_error']
); );
return $r;
} }
// Only create the payload if it was not created previously // Only create the payload if it was not created previously
if(empty($msg->payload)) if(empty($msg->payload))
@ -157,7 +158,7 @@
$this->errstr = 'Write error'; $this->errstr = 'Write error';
return CreateObject( return CreateObject(
'phpgwapi.xmlrpcresp', 'phpgwapi.xmlrpcresp',
0, '',
$GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcerr']['http_error'],
$GLOBALS['xmlrpcstr']['http_error'] $GLOBALS['xmlrpcstr']['http_error']
); );
@ -174,7 +175,7 @@
{ {
return CreateObject( return CreateObject(
'phpgwapi.xmlrpcresp', 'phpgwapi.xmlrpcresp',
0, '',
$GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcerr']['no_ssl'],
$GLOBALS['xmlrpcstr']['no_ssl'] $GLOBALS['xmlrpcstr']['no_ssl']
); );
@ -236,7 +237,7 @@
$this->errstr = 'Write error'; $this->errstr = 'Write error';
$resp = CreateObject( $resp = CreateObject(
'phpgwapi.xmlrpcresp', 'phpgwapi.xmlrpcresp',
0, '',
$GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcerr']['curl_fail'],
$GLOBALS['xmlrpcstr']['curl_fail'] . ': ' . curl_error($curl) $GLOBALS['xmlrpcstr']['curl_fail'] . ': ' . curl_error($curl)
); );

View File

@ -249,7 +249,7 @@
if (!xml_parse($parser, $data, 1)) if (!xml_parse($parser, $data, 1))
{ {
// return XML error as a faultCode // return XML error as a faultCode
$r = CreateObject('phpgwapi.xmlrpcresp',0, $r = CreateObject('phpgwapi.xmlrpcresp','',
$GLOBALS['xmlrpcerrxml'] + xml_get_error_code($parser), $GLOBALS['xmlrpcerrxml'] + xml_get_error_code($parser),
sprintf('XML error: %s at line %d', sprintf('XML error: %s at line %d',
xml_error_string(xml_get_error_code($parser)), xml_error_string(xml_get_error_code($parser)),
@ -293,10 +293,9 @@
if($sysCall && $this->authed) if($sysCall && $this->authed)
{ {
$r = CreateObject('phpgwapi.xmlrpcresp', $r = CreateObject('phpgwapi.xmlrpcresp',
CreateObject('phpgwapi.xmlrpcval', '',
$GLOBALS['xmlrpcstr']['unknown_method'] . ': ' . $methName, $GLOBALS['xmlrpcerr']['unknown_method'],
'string' $GLOBALS['xmlrpcstr']['unknown_method'] . ': ' . $methName
)
); );
return $r; return $r;
} }
@ -384,10 +383,9 @@
else else
{ {
$r = CreateObject('phpgwapi.xmlrpcresp', $r = CreateObject('phpgwapi.xmlrpcresp',
CreateObject('phpgwapi.xmlrpcval', '',
$GLOBALS['xmlrpcstr']['incorrect_params'] . ': ' . $sr[1], $GLOBALS['xmlrpcerr']['incorrect_params'],
'string' $GLOBALS['xmlrpcstr']['incorrect_params'] . ': ' . $sr[1]
)
); );
} }
} }
@ -396,15 +394,19 @@
// else prepare error response // else prepare error response
if(!$this->authed) if(!$this->authed)
{ {
$r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval','UNAUTHORIZED','string')); $r = CreateObject('phpgwapi.xmlrpcresp',
CreateObject('phpgwapi.xmlrpcval',
'UNAUTHORIZED',
'string'
)
);
} }
else else
{ {
$r = CreateObject('phpgwapi.xmlrpcresp', $r = CreateObject('phpgwapi.xmlrpcresp',
CreateObject('phpgwapi.xmlrpcval', '',
$GLOBALS['xmlrpcstr']['unknown_method'] . ': ' . $methName, $GLOBALS['xmlrpcerr']['unknown_method'],
'string' $GLOBALS['xmlrpcstr']['unknown_method'] . ': ' . $methName
)
); );
} }
} }

View File

@ -151,7 +151,7 @@
{ {
$errstr = substr($data, 0, strpos($data, "\n")-1); $errstr = substr($data, 0, strpos($data, "\n")-1);
error_log('HTTP error, got response: ' .$errstr); error_log('HTTP error, got response: ' .$errstr);
$r = CreateObject('phpgwapi.xmlrpcresp',0, $GLOBALS['xmlrpcerr']['http_error'], $r = CreateObject('phpgwapi.xmlrpcresp','', $GLOBALS['xmlrpcerr']['http_error'],
$GLOBALS['xmlrpcstr']['http_error'] . ' (' . $errstr . ')'); $GLOBALS['xmlrpcstr']['http_error'] . ' (' . $errstr . ')');
xml_parser_free($parser); xml_parser_free($parser);
return $r; return $r;
@ -199,7 +199,7 @@
xml_get_current_line_number($parser)); xml_get_current_line_number($parser));
} }
error_log($errstr); error_log($errstr);
$r = CreateObject('phpgwapi.xmlrpcresp', 0, $GLOBALS['xmlrpcerr']['invalid_return'],$GLOBALS['xmlrpcstr']['invalid_return']); $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['invalid_return'],$GLOBALS['xmlrpcstr']['invalid_return']);
xml_parser_free($parser); xml_parser_free($parser);
return $r; return $r;
} }
@ -215,7 +215,7 @@
// then something odd has happened // then something odd has happened
// and it's time to generate a client side error // and it's time to generate a client side error
// indicating something odd went on // indicating something odd went on
$r = CreateObject('phpgwapi.xmlrpcresp', 0, $GLOBALS['xmlrpcerr']['invalid_return'],$GLOBALS['xmlrpcstr']['invalid_return']); $r = CreateObject('phpgwapi.xmlrpcresp', '', $GLOBALS['xmlrpcerr']['invalid_return'],$GLOBALS['xmlrpcstr']['invalid_return']);
} }
else else
{ {

View File

@ -68,7 +68,7 @@
function serialize() function serialize()
{ {
$rs='<methodResponse>'."\n"; $rs='<methodResponse>'."\n";
if ($this->fn) if (isset($this->fn) && !empty($this->fn))
{ {
$rs .= '<fault> $rs .= '<fault>
<value> <value>