X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=php%2Fplc_api.php;h=ea90a8c8a0e1766f062f78db2ff4efa5b98e7852;hb=refs%2Fheads%2Fremove-xmlrpc;hp=f704cd438371b2ce815c4a59f89b147a34792d09;hpb=7a244becfc634d522f5c6f35aced759c001ff7f4;p=plcapi.git diff --git a/php/plc_api.php b/php/plc_api.php index f704cd4..ea90a8c 100644 --- a/php/plc_api.php +++ b/php/plc_api.php @@ -8,10 +8,6 @@ // Mark Huang // Copyright (C) 2005-2006 The Trustees of Princeton University // -// $Id$ -// $URL$ -// -// require_once 'plc_config.php'; @@ -61,9 +57,13 @@ class PLCAPI function backtrace_php () { $backtrace = debug_backtrace(); $msg = ""; - foreach( $backtrace as $line ) { + $len = count($backtrace); + $cnt = 1; + foreach( array_reverse($backtrace) as $line ) { $msg .= "File '". $line['file'] . "' line " . $line['line'] . "\n"; $msg .= " " . $line['function'] . "( " . $this->rec_join($line['args']) . ")\n"; + $cnt += 1; + if ( $cnt == $len ) { break; } } return $msg; } @@ -77,7 +77,7 @@ class PLCAPI $error_line='PLCAPI error: ' . $error_msg ; if ($file) $error_line .= ' in file ' . $file; if ($line) $error_line .= ' on line ' . $line; - $this->errors[] = $error_line + $this->errors[] = $error_line; # TODO: setup a config variable for more detailed stack traces, for API errors. if ( TRUE ){ error_log($error_line); @@ -142,7 +142,9 @@ class PLCAPI // Marshal the XML-RPC request as a POST variable. is an // extension to the XML-RPC spec that is supported in our custom // version of xmlrpc.so via the 'allow_null' output_encoding key. - $request = xmlrpc_encode_request($method, $args, array('allow_null' => TRUE)); + $request = xmlrpc_encode_request($method, $args, array('null_extension')); + error_log("ENCODED: " . $method . "(" . $args . ")"); + error_log("OBTAINED: " . $request); curl_setopt($curl, CURLOPT_POSTFIELDS, $request); // Construct the HTTP header @@ -241,10 +243,15 @@ class PLCAPI } } +// this tentatively allows to tune mainstream xmlrpc php lib +// so as to achieve the same behaviour as with our patched lib +$GLOBALS['xmlrpc_null_extension'] = true; +$GLOBALS['$xmlrpc_null_apache_encoding'] = true; + global $adm; $adm = new PLCAPI(array('AuthMethod' => "capability", - 'Username' => PLC_API_MAINTENANCE_USER, + 'Username' => PLC_API_MAINTENANCE_USER, 'AuthString' => PLC_API_MAINTENANCE_PASSWORD)); ?>