[PATCH] XML_RPC Server Debug

From: Date: Sun, 11 Jan 2004 00:33:15 +0000
Subject: [PATCH] XML_RPC Server Debug
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24968@lists.php.net to get a copy of this message
Hi, The enclosed patch allows the server debugging to be switched off when outputting the XML-RPC response. By default, I've left it so that debugging is aways switched off as I figured that in a production environment, it wouldn't be necessarily to have it switched on, especially when request packets are large, and the debugging info just sends all the input values back to the client. I leave it to you guys to decide which is best as the debug information is contained in a comment anyway, so it should cause any problems either way. Debugging is switched on in a similar way to the client (the setDebug function was simply cut'n'paste from the client code), e.g. $server = new XML_RPC_Server ( $data, FALSE ) ; $server->setDebug (TRUE) ; $server->service () ; It seemed to make more sense to change XML_RPC_Server::serializeDebug rather than modify any other code to make use of the $debug property. Best, Mark -- Mark Mitchenall, Standingwave Ltd Tel := +44 (0)20 8452 3031 Email := mark@standingwave.co.uk mark@mitchenall.com Home := http://www.standingwave.co.uk http://www.mitchenall.com ? server_setDebug.diff Index: Server.php =================================================================== RCS file: /repository/pear/XML_RPC/Server.php,v retrieving revision 1.4 diff -u -r1.4 Server.php --- Server.php 14 Sep 2003 03:45:56 -0000 1.4 +++ Server.php 11 Jan 2004 00:08:29 -0000 @@ -151,7 +151,8 @@ class XML_RPC_Server { var $dmap = array(); - + var $debug = 0; + function XML_RPC_Server($dispMap, $serviceNow = 1) { global $HTTP_RAW_POST_DATA; @@ -169,7 +170,7 @@ function serializeDebug() { global $XML_RPC_Server_debuginfo; - if ($XML_RPC_Server_debuginfo != "") + if ($XML_RPC_Server_debuginfo != "" && $this->debug == 1) return "<!-- DEBUG INFO:\n\n" . $XML_RPC_Server_debuginfo . "\n-->\n"; else return ""; @@ -307,6 +308,16 @@ $r->xv = new XML_RPC_Value("'Aha said I: '" . $HTTP_RAW_POST_DATA, "string"); print $r->serialize(); } + + function setDebug($in) + { + if ($in) { + $this->debug = 1; + } else { + $this->debug = 0; + } + } + } -?> +?> \ No newline at end of file

« previous php.pear.dev (#24968) next »