[phpxmlrpc] Server.php in XML/RPC package: inability to switch off debugging - suggested modification

Pascal Van Hecke pascalvanhecke at yahoo.com
Mon Aug 11 15:10:32 BST 2003

(note: this was also posted to pear-dev mailinglist,
but got bounced on this one because of spam suspicion
- I sent it from another provider)


In the Server.php file of the XML/RPC package
(contributed by Edd Dumbill and pearified by Stig
Bakken), there's no option to switch of the output of
an (outcommented) debug log in the resulting XML-RPC

Because the XML_RPC_Server class only method is its
constructor, and this constructor does everything, the
only way to modify this was by adding an extra debug
parameter in the constructor.
Because the current signature is:

function XML_RPC_Server($dispMap, $serviceNow=1)

and I wanted to have backwards compatibility, I
changed the signature to

function XML_RPC_Server($dispMap, $option_array = 1)
and then checked the $option_array parameter for
"arrayness" :-).

A possible constructor could be now:

$DB_RPC_RemoteDataObjectServer = new XML_RPC_Server
						"query" => array
							"function"  =>
						//"other_function"=> array ("function" =>
						"debug" => 0

Part of the modified and attached Server.php file is
quoted hereunder (functions XML_RPC_Server and
serializeDebug have been changed)

Could this maybe be incorporated in PEAR CVS?


pascal van hecke

Line 150-94 

class XML_RPC_Server
    var $dmap=array();
    var $debug;

    // function XML_RPC_Server($dispMap,
$serviceNow=1)//changed by pvh
    function XML_RPC_Server($dispMap, $option_array =
		// dispMap is a despatch array of methods
		// mapped to function names and signatures
		// if a method
		// doesn't appear in the map then an unknown
		// method error is generated
		if (is_array($option_array))
		// second parameter carries associative array with
some initialisation
			if (array_key_exists("debug", $option_array))
$this->debug = $option_array["debug"];
			if (array_key_exists("serviceNow", $option_array)) 
				$serviceNow = $option_array["serviceNow"];
				$serviceNow = 1;
		// second parameter matches $servicenow param in old
			$serviceNow = $option_array;
		if ($serviceNow) 

    function serializeDebug()
        global $XML_RPC_Server_debuginfo;
        if ($XML_RPC_Server_debuginfo!="" and
            return "<!-- DEBUG INFO:\n\n" .
                $XML_RPC_Server_debuginfo . "\n-->\n";
            return "";

Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Server.php
Type: text/x-csv
Size: 12186 bytes
Desc: Server.php
Url : http://lists.usefulinc.com/pipermail/phpxmlrpc/attachments/20030811/b694f97e/Server.bin

More information about the phpxmlrpc mailing list