From 703405e3618c751b3e9e69321e878ea9573449a4 Mon Sep 17 00:00:00 2001
From: gggeek <giunta.gaetano@gmail.com>
Date: Mon, 26 May 2014 22:31:28 +0100
Subject: [PATCH] More tabs/to/spaces conversion, plus remove closing php tags
 as they are not considered good style anymore

---
 Makefile                    |   14 +-
 debugger/controller.php     |   24 +-
 demo/client/client.php      |   72 +-
 demo/client/comment.php     |  182 ++--
 demo/client/introspect.php  |  109 +--
 demo/client/mail.php        |   58 +-
 demo/client/simple_call.php |   94 +-
 demo/client/which.php       |   33 +-
 demo/client/wrap.php        |   84 +-
 demo/client/zopetest.php    |   38 +-
 demo/server/discuss.php     |  217 +++--
 demo/server/proxy.php       |  139 ++-
 demo/server/server.php      | 1626 +++++++++++++++++------------------
 demo/vardemo.php            |  142 +--
 doc/convert.php             |    1 -
 doc/highlight.php           |   22 +-
 doc/xmlrpc_php.xml          |   24 +-
 lib/phpxmlrpc.php           |    2 -
 lib/xmlrpc.php              |    8 +-
 lib/xmlrpc_client.php       |    4 +-
 lib/xmlrpc_wrappers.php     |    3 +-
 lib/xmlrpcmsg.php           |    1 -
 lib/xmlrpcresp.php          |    2 -
 lib/xmlrpcs.php             |    9 +-
 lib/xmlrpcval.php           |    2 -
 test/benchmark.php          |  519 ++++++-----
 test/parse_args.php         |  231 +++--
 test/testsuite.php          |    1 -
 28 files changed, 1754 insertions(+), 1907 deletions(-)

diff --git a/Makefile b/Makefile
index b5760a26..bcb4a906 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 # Makefile for phpxmlrpc library
 
-### USER EDITABLE VARS ###
+### USER EDITABLE VARS - can be passed as command-line options ###
 
 # path to PHP executable, preferably CLI version
 PHP=/usr/local/bin/php
@@ -14,13 +14,15 @@ MKDIR=mkdir
 #find too
 FIND=find
 
+DOS2UNIX=dos2unix
 
 #### DO NOT TOUCH FROM HERE ONWARDS ###
 
 # recover version number from code
 # thanks to Firman Pribadi for unix command line help
 #   on unix shells lasts char should be \\2/g )
-export VERSION=$(shell egrep "\$GLOBALS *\[ *'xmlrpcVersion' *\] *= *'" lib/xmlrpc.inc | sed -r s/"(.*= *' *)([0-9a-zA-Z.-]+)(.*)"/\2/g )
+###export VERSION=$(shell grep -E "\$GLOBALS *\[ *'xmlrpcVersion' *\] *= *'" lib/xmlrpc.inc | sed -r s/"(.*= *' *)([0-9a-zA-Z.-]+)(.*)"/\2/g )
+export VERSION=3.0.0
 
 LIBFILES=lib/xmlrpc.inc lib/xmlrpcs.inc lib/xmlrpc_wrappers.inc
 
@@ -79,10 +81,10 @@ test:
 
 ### the following targets are to be used for library development ###
 
-# make tag target: tag existing working copy as release in cvs.
-# todo: convert dots in underscore in $VERSION
+# make tag target: tag existing working copy as release in git.
 tag:
-	cvs -q tag -p release_${VERSION}
+	git tag v${VERSION}
+	git push origin --tags
 
 dist: xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz
 
@@ -108,7 +110,7 @@ xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz: ${LIBFILES} ${DEBUGGERFILES} ${I
 	cp ${INFOFILES} xmlrpc-${VERSION}
 	cd doc && $(MAKE) dist
 #   on unix shells last char should be \;
-	${FIND} xmlrpc-${VERSION} -type f ! -name "*.fttb" ! -name "*.pdf" ! -name "*.gif" -exec dos2unix {} ;
+	${FIND} xmlrpc-${VERSION} -type f ! -name "*.fttb" ! -name "*.pdf" ! -name "*.gif" -exec ${DOS2UNIX} {} ;
 	-rm xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz
 	tar -cvf xmlrpc-${VERSION}.tar xmlrpc-${VERSION}
 	gzip xmlrpc-${VERSION}.tar
diff --git a/debugger/controller.php b/debugger/controller.php
index 98550c9d..e903be44 100644
--- a/debugger/controller.php
+++ b/debugger/controller.php
@@ -172,20 +172,20 @@ td {vertical-align: top; font-family: Verdana, Arial, Helvetica; font-size: 8pt;
   {
     if (show && ((typeof base64_decode) == 'function'))
     {
-	  document.getElementById('methodpayloadbtn').innerHTML = '[<a href="#" onclick="activateeditor(); return false;">Edit</a>]';
-	}
-	else
+      document.getElementById('methodpayloadbtn').innerHTML = '[<a href="#" onclick="activateeditor(); return false;">Edit</a>]';
+    }
+    else
     {
-	  document.getElementById('methodpayloadbtn').innerHTML = '';
-	}
+      document.getElementById('methodpayloadbtn').innerHTML = '';
+    }
   }
 
   function activateeditor()
   {
-	  var url = '<?php echo $editorpath; ?>visualeditor.php?params=<?php echo $alt_payload; ?>';
-	  if (document.frmaction.wstype.value == "1")
-	    url += '&type=jsonrpc';
-	  var wnd = window.open(url, '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1');
+      var url = '<?php echo $editorpath; ?>visualeditor.php?params=<?php echo $alt_payload; ?>';
+      if (document.frmaction.wstype.value == "1")
+        url += '&type=jsonrpc';
+      var wnd = window.open(url, '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1');
   }
 
   // if javascript version of the lib is found, allow it to send us params
@@ -193,9 +193,9 @@ td {vertical-align: top; font-family: Verdana, Arial, Helvetica; font-size: 8pt;
   {
     if (typeof base64_decode == 'function')
     {
-	  if (base64data == '0') // workaround for bug in base64_encode...
-	    document.getElementById('methodpayload').value = '';
-	  else
+      if (base64data == '0') // workaround for bug in base64_encode...
+        document.getElementById('methodpayload').value = '';
+      else
         document.getElementById('methodpayload').value = base64_decode(base64data);
     }
   }
diff --git a/demo/client/client.php b/demo/client/client.php
index b5ec0017..c457a41a 100644
--- a/demo/client/client.php
+++ b/demo/client/client.php
@@ -5,45 +5,45 @@
 <h2>Send a U.S. state number to the server and get back the state name</h2>
 <h3>The code demonstrates usage of the php_xmlrpc_encode function</h3>
 <?php
-	include("xmlrpc.inc");
+    include("xmlrpc.inc");
 
-	// Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
-	if(!isset($HTTP_POST_VARS) && isset($_POST))
-	{
-		$HTTP_POST_VARS = $_POST;
-	}
+    // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
+    if(!isset($HTTP_POST_VARS) && isset($_POST))
+    {
+        $HTTP_POST_VARS = $_POST;
+    }
 
-	if(isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"]!="")
-	{
-		$stateno=(integer)$HTTP_POST_VARS["stateno"];
-		$f=new xmlrpcmsg('examples.getStateName',
-			array(php_xmlrpc_encode($stateno))
-		);
-		print "<pre>Sending the following request:\n\n" . htmlentities($f->serialize()) . "\n\nDebug info of server data follows...\n\n";
-		$c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
-		$c->setDebug(1);
-		$r=&$c->send($f);
-		if(!$r->faultCode())
-		{
-			$v=$r->value();
-			print "</pre><br/>State number " . $stateno . " is "
-				. htmlspecialchars($v->scalarval()) . "<br/>";
-			// print "<HR>I got this value back<BR><PRE>" .
-			//  htmlentities($r->serialize()). "</PRE><HR>\n";
-		}
-		else
-		{
-			print "An error occurred: ";
-			print "Code: " . htmlspecialchars($r->faultCode())
-				. " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>";
-		}
-	}
-	else
-	{
-		$stateno = "";
-	}
+    if(isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"]!="")
+    {
+        $stateno=(integer)$HTTP_POST_VARS["stateno"];
+        $f=new xmlrpcmsg('examples.getStateName',
+            array(php_xmlrpc_encode($stateno))
+        );
+        print "<pre>Sending the following request:\n\n" . htmlentities($f->serialize()) . "\n\nDebug info of server data follows...\n\n";
+        $c=new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
+        $c->setDebug(1);
+        $r=&$c->send($f);
+        if(!$r->faultCode())
+        {
+            $v=$r->value();
+            print "</pre><br/>State number " . $stateno . " is "
+                . htmlspecialchars($v->scalarval()) . "<br/>";
+            // print "<HR>I got this value back<BR><PRE>" .
+            //  htmlentities($r->serialize()). "</PRE><HR>\n";
+        }
+        else
+        {
+            print "An error occurred: ";
+            print "Code: " . htmlspecialchars($r->faultCode())
+                . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>";
+        }
+    }
+    else
+    {
+        $stateno = "";
+    }
 
-	print "<form action=\"client.php\" method=\"POST\">
+    print "<form action=\"client.php\" method=\"POST\">
 <input name=\"stateno\" value=\"" . $stateno . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form>
 <p>Enter a state number to query its name</p>";
 
diff --git a/demo/client/comment.php b/demo/client/comment.php
index 7133cf95..914c92ca 100644
--- a/demo/client/comment.php
+++ b/demo/client/comment.php
@@ -6,41 +6,41 @@ $mydir="/demo";
 // define some utility functions
 function bomb() { print "</body></html>"; exit(); }
 function dispatch($client, $method, $args) {
-	$msg=new xmlrpcmsg($method, $args);
-	$resp=$client->send($msg);
-	if (!$resp) { print "<p>IO error: ".$client->errstr."</p>"; bomb(); }
-	if ($resp->faultCode()) {
-		print "<p>There was an error: " . $resp->faultCode() . " " .
-			$resp->faultString() . "</p>";
-		bomb();
-	}
-	return php_xmlrpc_decode($resp->value());
+    $msg=new xmlrpcmsg($method, $args);
+    $resp=$client->send($msg);
+    if (!$resp) { print "<p>IO error: ".$client->errstr."</p>"; bomb(); }
+    if ($resp->faultCode()) {
+        print "<p>There was an error: " . $resp->faultCode() . " " .
+            $resp->faultString() . "</p>";
+        bomb();
+    }
+    return php_xmlrpc_decode($resp->value());
 }
 
 // create client for discussion server
 $dclient=new xmlrpc_client("${mydir}/discuss.php",
-													 "xmlrpc.usefulinc.com", 80);
+                                                     "xmlrpc.usefulinc.com", 80);
 
 // check if we're posting a comment, and send it if so
 @$storyid=$_POST["storyid"];
 if ($storyid) {
 
 
-	//	print "Returning to " . $HTTP_POST_VARS["returnto"];
+    //    print "Returning to " . $HTTP_POST_VARS["returnto"];
 
-	$res=dispatch($dclient, "discuss.addComment",
-								array(new xmlrpcval($storyid),
-											new xmlrpcval(stripslashes
-																		(@$_POST["name"])),
-											new xmlrpcval(stripslashes
-																		(@$_POST["commenttext"]))));
+    $res=dispatch($dclient, "discuss.addComment",
+                                array(new xmlrpcval($storyid),
+                                            new xmlrpcval(stripslashes
+                                                                        (@$_POST["name"])),
+                                            new xmlrpcval(stripslashes
+                                                                        (@$_POST["commenttext"]))));
 
-	// send the browser back to the originating page
-	Header("Location: ${mydir}/comment.php?catid=" .
-				 $_POST["catid"] . "&chanid=" .
-				 $_POST["chanid"] . "&oc=" .
-				 $_POST["catid"]);
-	exit(0);
+    // send the browser back to the originating page
+    Header("Location: ${mydir}/comment.php?catid=" .
+                 $_POST["catid"] . "&chanid=" .
+                 $_POST["chanid"] . "&oc=" .
+                 $_POST["catid"]);
+    exit(0);
 }
 
 // now we've got here, we're exploring the story store
@@ -52,17 +52,17 @@ if ($storyid) {
 <?php
 @$catid=$_GET["catid"];
 if (@$_GET["oc"]==$catid)
-	@$chanid=$_GET["chanid"];
+    @$chanid=$_GET["chanid"];
 else
-	$chanid=0;
+    $chanid=0;
 
 $client=new xmlrpc_client("/meerkat/xml-rpc/server.php",
-													"www.oreillynet.com", 80);
+                                                    "www.oreillynet.com", 80);
 
 if (@$_GET["comment"] &&
-		(!@$_GET["cdone"])) {
-	// we're making a comment on a story,
-	// so display a comment form
+        (!@$_GET["cdone"])) {
+    // we're making a comment on a story,
+    // so display a comment form
 ?>
 <h3>Make a comment on the story</h3>
 <form method="post">
@@ -80,54 +80,54 @@ if (@$_GET["comment"] &&
 </form>
 <?php
 } else {
-	$categories=dispatch($client, "meerkat.getCategories", array());
-	if ($catid)
-		$sources = dispatch($client, "meerkat.getChannelsByCategory",
-												array(new xmlrpcval($catid, "int")));
-	if ($chanid) {
-		$stories = dispatch($client, "meerkat.getItems",
-					array(new xmlrpcval(
-						array(
-							"channel" => new xmlrpcval($chanid, "int"),
-							"ids" => new xmlrpcval(1, "int"),
-							"descriptions" => new xmlrpcval(200, "int"),
-							"num_items" => new xmlrpcval(5, "int"),
-							"dates" => new xmlrpcval(0, "int")
-						), "struct")));
-	}
+    $categories=dispatch($client, "meerkat.getCategories", array());
+    if ($catid)
+        $sources = dispatch($client, "meerkat.getChannelsByCategory",
+                                                array(new xmlrpcval($catid, "int")));
+    if ($chanid) {
+        $stories = dispatch($client, "meerkat.getItems",
+                    array(new xmlrpcval(
+                        array(
+                            "channel" => new xmlrpcval($chanid, "int"),
+                            "ids" => new xmlrpcval(1, "int"),
+                            "descriptions" => new xmlrpcval(200, "int"),
+                            "num_items" => new xmlrpcval(5, "int"),
+                            "dates" => new xmlrpcval(0, "int")
+                        ), "struct")));
+    }
 ?>
 <form>
 <p>Subject area:<br />
 <select name="catid">
 <?php
-	if (!$catid)
-		print "<option value=\"0\">Choose a category</option>\n";
-	while(list($k,$v) = each($categories)) {
-		print "<option value=\"" . $v['id'] ."\"";
-		if ($v['id']==$catid) print " selected=\"selected\"";
-			print ">". $v['title'] . "</option>\n";
-	}
+    if (!$catid)
+        print "<option value=\"0\">Choose a category</option>\n";
+    while(list($k,$v) = each($categories)) {
+        print "<option value=\"" . $v['id'] ."\"";
+        if ($v['id']==$catid) print " selected=\"selected\"";
+            print ">". $v['title'] . "</option>\n";
+    }
 ?>
 </select></p>
 <?php
-	if ($catid) {
+    if ($catid) {
 ?>
 <p>News source:<br />
 <select name="chanid">
 <?php
-		if (!$chanid)
-			print "<option value=\"0\">Choose a source</option>\n";
-		while(list($k,$v) = each($sources)) {
-			print "<option value=\"" . $v['id'] ."\"";
-			if ($v['id']==$chanid) print "\" selected=\"selected\"";
-			print ">". $v['title'] . "</option>\n";
-		}
+        if (!$chanid)
+            print "<option value=\"0\">Choose a source</option>\n";
+        while(list($k,$v) = each($sources)) {
+            print "<option value=\"" . $v['id'] ."\"";
+            if ($v['id']==$chanid) print "\" selected=\"selected\"";
+            print ">". $v['title'] . "</option>\n";
+        }
 ?>
 </select>
 </p>
 
 <?php
-		} // end if ($catid)
+        } // end if ($catid)
 ?>
 
 <p><input type="submit" value="Update" /></p>
@@ -135,51 +135,51 @@ if (@$_GET["comment"] &&
 </form>
 
 <?php
-	 if ($chanid) {
+     if ($chanid) {
 ?>
 
 <h2>Stories available</h2>
 <table>
 <?php
-	 while(list($k,$v) = each($stories)) {
-		 print "<tr>";
-		 print "<td><b>" . $v['title'] . "</b><br />";
-		 print $v['description'] . "<br />";
-		 print "<em><a target=\"_blank\" href=\"" .
-			 $v['link'] . "\">Read full story</a> ";
-		 print "<a href=\"comment.php?catid=${catid}&chanid=${chanid}&" .
-			 "oc=${oc}&comment=" . $v['id'] . "\">Comment on this story</a>";
-		 print "</em>";
-		 print "</td>";
-		 print "</tr>\n";
-		 // now look for existing comments
-		 $res=dispatch($dclient, "discuss.getComments",
-							array(new xmlrpcval($v['id'])));
-		 if (sizeof($res)>0) {
-			 print "<tr><td bgcolor=\"#dddddd\"><p><b><i>" .
-				 "Comments on this story:</i></b></p>";
-			 for($i=0; $i<sizeof($res); $i++) {
-				 $s=$res[$i];
-				 print "<p><b>From:</b> " . htmlentities($s['name']) . "<br />";
-				 print "<b>Comment:</b> " . htmlentities($s['comment']) . "</p>";
-			 }
-			 print "</td></tr>\n";
-		 }
-		 print "<tr><td><hr /></td></tr>\n";
-	 }
+     while(list($k,$v) = each($stories)) {
+         print "<tr>";
+         print "<td><b>" . $v['title'] . "</b><br />";
+         print $v['description'] . "<br />";
+         print "<em><a target=\"_blank\" href=\"" .
+             $v['link'] . "\">Read full story</a> ";
+         print "<a href=\"comment.php?catid=${catid}&chanid=${chanid}&" .
+             "oc=${oc}&comment=" . $v['id'] . "\">Comment on this story</a>";
+         print "</em>";
+         print "</td>";
+         print "</tr>\n";
+         // now look for existing comments
+         $res=dispatch($dclient, "discuss.getComments",
+                            array(new xmlrpcval($v['id'])));
+         if (sizeof($res)>0) {
+             print "<tr><td bgcolor=\"#dddddd\"><p><b><i>" .
+                 "Comments on this story:</i></b></p>";
+             for($i=0; $i<sizeof($res); $i++) {
+                 $s=$res[$i];
+                 print "<p><b>From:</b> " . htmlentities($s['name']) . "<br />";
+                 print "<b>Comment:</b> " . htmlentities($s['comment']) . "</p>";
+             }
+             print "</td></tr>\n";
+         }
+         print "<tr><td><hr /></td></tr>\n";
+     }
 ?>
 </table>
 
 <?php
-		} // end if ($chanid)
+        } // end if ($chanid)
 } // end if comment
 ?>
 <hr />
 <p>
 <a href="http://meerkat.oreillynet.com"><img align="right"
-	src="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg"
-	height="31" width="88" alt="Meerkat powered, yeah!"
-	border="0" hspace="8" /></a>
+    src="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg"
+    height="31" width="88" alt="Meerkat powered, yeah!"
+    border="0" hspace="8" /></a>
 <em>$Id$</em></p>
 </body>
 </html>
diff --git a/demo/client/introspect.php b/demo/client/introspect.php
index 818e04c6..0633bc7c 100644
--- a/demo/client/introspect.php
+++ b/demo/client/introspect.php
@@ -1,108 +1 @@
-<html>

-<head><title>xmlrpc</title></head>

-<body>

-<h1>Introspect demo</h1>

-<h2>Query server for available methods and their description</h2>

-<h3>The code demonstrates usage of multicall and introspection methods</h3>

-<?php

-	include("xmlrpc.inc");

-

-	function display_error($r)

-	{

-		print "An error occurred: ";

-		print "Code: " . $r->faultCode()

-			. " Reason: '" .$r->faultString()."'<br/>";

-	}

-

-	// 'new style' client constuctor

-	$c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php");

-	print "<h3>methods available at http://" . $c->server . $c->path .  "</h3>\n";

-

-	$m = new xmlrpcmsg('system.listMethods');

-	$r =& $c->send($m);

-	if($r->faultCode())

-	{

-		display_error($r);

-	}

-	else

-	{

-		$v=$r->value();

-		for($i=0; $i<$v->arraysize(); $i++)

-		{

-			$mname=$v->arraymem($i);

-			print "<h4>" . $mname->scalarval() . "</h4>\n";

-

-			// build messages first, add params later

-			$m1  = new xmlrpcmsg('system.methodHelp');

-			$m2  = new xmlrpcmsg('system.methodSignature');

-			$val = new xmlrpcval($mname->scalarval(), "string");

-			$m1->addParam($val);

-			$m2->addParam($val);

-

-			// send multiple messages in one pass.

-			// If server does not support multicall, client will fall back to 2 separate calls

-			$ms = array($m1, $m2);

-			$rs =& $c->send($ms);

-

-			if($rs[0]->faultCode())

-			{

-				display_error($rs[0]);

-			}

-			else

-			{

-				$val=$rs[0]->value();

-				$txt=$val->scalarval();

-				if($txt != "")

-				{

-					print "<h4>Documentation</h4><p>${txt}</p>\n";

-				}

-				else

-				{

-					print "<p>No documentation available.</p>\n";

-				}

-			}

-

-			if($rs[1]->faultCode())

-			{

-				display_error($rs[1]);

-			}

-			else

-			{

-				print "<h4>Signature</h4><p>\n";

-				$val = $rs[1]->value();

-				if($val->kindOf()=="array")

-				{

-					for($j=0; $j<$val->arraysize(); $j++)

-					{

-						$x = $val->arraymem($j);

-						$ret = $x->arraymem(0);

-						print "<code>" . $ret->scalarval() . " "

-							. $mname->scalarval() . "(";

-						if($x->arraysize()>1)

-						{

-							for($k=1; $k<$x->arraysize(); $k++)

-							{

-								$y = $x->arraymem($k);

-								print $y->scalarval();

-								if($k < $x->arraysize()-1)

-								{

-									print ", ";

-								}

-							}

-						}

-						print ")</code><br/>\n";

-					}

-				}

-				else

-				{

-					print "Signature unknown\n";

-				}

-				print "</p>\n";

-			}

-		}

-	}

-?>

-<hr/>

-<em>$Id$</em>

-</body>

-</html>

+<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Introspect demo</h1>

<h2>Query server for available methods and their description</h2>

<h3>The code demonstrates usage of multicall and introspection methods</h3>

<?php

    include("xmlrpc.inc");



    function display_error($r)

    {

        print "An error occurred: ";

        print "Code: " . $r->faultCode()

            . " Reason: '" .$r->faultString()."'<br/>";

    }



    // 'new style' client constuctor

    $c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php");

    print "<h3>methods available at http://" . $c->server . $c->path .  "</h3>\n";



    $m = new xmlrpcmsg('system.listMethods');

    $r =& $c->send($m);

    if($r->faultCode())

    {

        display_error($r);

    }

    else

    {

        $v=$r->value();

        for($i=0; $i<$v->arraysize(); $i++)

        {

            $mname=$v->arraymem($i);

            print "<h4>" . $mname->scalarval() . "</h4>\n";



            // build messages first, add params later

            $m1  = new xmlrpcmsg('system.methodHelp');

            $m2  = new xmlrpcmsg('system.methodSignature');

            $val = new xmlrpcval($mname->scalarval(), "string");

            $m1->addParam($val);

            $m2->addParam($val);



            // send multiple messages in one pass.

            // If server does not support multicall, client will fall back to 2 separate calls

            $ms = array($m1, $m2);

            $rs =& $c->send($ms);



            if($rs[0]->faultCode())

            {

                display_error($rs[0]);

            }

            else

            {

                $val=$rs[0]->value();

                $txt=$val->scalarval();

                if($txt != "")

                {

                    print "<h4>Documentation</h4><p>${txt}</p>\n";

                }

                else

                {

                    print "<p>No documentation available.</p>\n";

                }

            }



            if($rs[1]->faultCode())

            {

                display_error($rs[1]);

            }

            else

            {

                print "<h4>Signature</h4><p>\n";

                $val = $rs[1]->value();

                if($val->kindOf()=="array")

                {

                    for($j=0; $j<$val->arraysize(); $j++)

                    {

                        $x = $val->arraymem($j);

                        $ret = $x->arraymem(0);

                        print "<code>" . $ret->scalarval() . " "

                            . $mname->scalarval() . "(";

                        if($x->arraysize()>1)

                        {

                            for($k=1; $k<$x->arraysize(); $k++)

                            {

                                $y = $x->arraymem($k);

                                print $y->scalarval();

                                if($k < $x->arraysize()-1)

                                {

                                    print ", ";

                                }

                            }

                        }

                        print ")</code><br/>\n";

                    }

                }

                else

                {

                    print "Signature unknown\n";

                }

                print "</p>\n";

            }

        }

    }

?>

<hr/>

<em>$Id$</em>

</body>

</html>

\ No newline at end of file
diff --git a/demo/client/mail.php b/demo/client/mail.php
index f73ed377..f0fd82ee 100644
--- a/demo/client/mail.php
+++ b/demo/client/mail.php
@@ -1,8 +1,8 @@
 <?php
 // Allow users to see the source of this file even if PHP is not configured for it
 if ((isset($HTTP_GET_VARS['showSource']) && $HTTP_GET_VARS['showSource']) ||
-	(isset($_GET['showSource']) && $_GET['showSource']))
-	{ highlight_file(__FILE__); die(); }
+    (isset($_GET['showSource']) && $_GET['showSource']))
+    { highlight_file(__FILE__); die(); }
 ?>
 <html>
 <head><title>xmlrpc</title></head>
@@ -18,36 +18,36 @@ include("xmlrpc.inc");
 
 // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
 if (!isset($HTTP_POST_VARS) && isset($_POST))
-	$HTTP_POST_VARS = $_POST;
+    $HTTP_POST_VARS = $_POST;
 
 if (isset($HTTP_POST_VARS["server"]) && $HTTP_POST_VARS["server"]) {
-	if ($HTTP_POST_VARS["server"]=="Userland") {
-		$XP="/RPC2"; $XS="206.204.24.2";
-	} else {
-		$XP="/xmlrpc/server.php"; $XS="pingu.heddley.com";
-	}
-	$f=new xmlrpcmsg('mail.send');
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailto"]));
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailsub"]));
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailmsg"]));
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailfrom"]));
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailcc"]));
-	$f->addParam(new xmlrpcval($HTTP_POST_VARS["mailbcc"]));
-	$f->addParam(new xmlrpcval("text/plain"));
+    if ($HTTP_POST_VARS["server"]=="Userland") {
+        $XP="/RPC2"; $XS="206.204.24.2";
+    } else {
+        $XP="/xmlrpc/server.php"; $XS="pingu.heddley.com";
+    }
+    $f=new xmlrpcmsg('mail.send');
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailto"]));
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailsub"]));
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailmsg"]));
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailfrom"]));
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailcc"]));
+    $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailbcc"]));
+    $f->addParam(new xmlrpcval("text/plain"));
 
-	$c=new xmlrpc_client($XP, $XS, 80);
-	$c->setDebug(2);
-	$r=&$c->send($f);
-	if (!$r->faultCode()) {
-		print "Mail sent OK<br/>\n";
-	} else {
-		print "<fonr color=\"red\">";
-		print "Mail send failed<br/>\n";
-		print "Fault: ";
-		print "Code: " . htmlspecialchars($r->faultCode()) .
-	  " Reason: '" . htmlspecialchars($r->faultString()) . "'<br/>";
-		print "</font><br/>";
-	}
+    $c=new xmlrpc_client($XP, $XS, 80);
+    $c->setDebug(2);
+    $r=&$c->send($f);
+    if (!$r->faultCode()) {
+        print "Mail sent OK<br/>\n";
+    } else {
+        print "<fonr color=\"red\">";
+        print "Mail send failed<br/>\n";
+        print "Fault: ";
+        print "Code: " . htmlspecialchars($r->faultCode()) .
+      " Reason: '" . htmlspecialchars($r->faultString()) . "'<br/>";
+        print "</font><br/>";
+    }
 }
 ?>
 <form method="POST">
diff --git a/demo/client/simple_call.php b/demo/client/simple_call.php
index 9d47dc8a..6f907d5c 100644
--- a/demo/client/simple_call.php
+++ b/demo/client/simple_call.php
@@ -6,53 +6,53 @@
  * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
  */
 
-	/**
-	 * Takes a client object, a remote method name, and a variable numbers of
-	 * php values, and calls the method with the supplied parameters. The
-	 * parameters are native php values and the result is an xmlrpcresp object.
-	 *
-	 * Notes:
-	 * The function encodes the received parameters using php_xmlrpc_encode:
-	 * the limitations of automatic encoding apply to this function too);
-	 *
-	 * the type of the value returned by the function can be changed setting
-	 * beforehand the 'return_type' member of the client object to 'phpvals' -
-	 * see the manual for more details about this capability).
-	 *
-	 *
-	 * @author Toth Istvan
-	 *
-	 * @param xmlrpc_client client object, properly set up to connect to server
-	 * @param string remote function name
-	 * @param mixed $parameter1
-	 * @param mixed $parameter2
-	 * @param mixed $parameter3 ...
-	 * @return xmlrpcresp or false on error
-	 */
-	function xmlrpccall_simple()
-	{
-		if(func_num_args() < 2)
-		{
-			// Incorrect
-			return false;
-		}
-		else
-		{
-			$varargs = func_get_args();
-			$client = array_shift($varargs);
-			$remote_function_name = array_shift($varargs);
-			if (!is_a($client, 'xmlrpc_client') || !is_string($remote_function_name))
-			{
-				return false;
-			}
+    /**
+     * Takes a client object, a remote method name, and a variable numbers of
+     * php values, and calls the method with the supplied parameters. The
+     * parameters are native php values and the result is an xmlrpcresp object.
+     *
+     * Notes:
+     * The function encodes the received parameters using php_xmlrpc_encode:
+     * the limitations of automatic encoding apply to this function too);
+     *
+     * the type of the value returned by the function can be changed setting
+     * beforehand the 'return_type' member of the client object to 'phpvals' -
+     * see the manual for more details about this capability).
+     *
+     *
+     * @author Toth Istvan
+     *
+     * @param xmlrpc_client client object, properly set up to connect to server
+     * @param string remote function name
+     * @param mixed $parameter1
+     * @param mixed $parameter2
+     * @param mixed $parameter3 ...
+     * @return xmlrpcresp or false on error
+     */
+    function xmlrpccall_simple()
+    {
+        if(func_num_args() < 2)
+        {
+            // Incorrect
+            return false;
+        }
+        else
+        {
+            $varargs = func_get_args();
+            $client = array_shift($varargs);
+            $remote_function_name = array_shift($varargs);
+            if (!is_a($client, 'xmlrpc_client') || !is_string($remote_function_name))
+            {
+                return false;
+            }
 
-			$xmlrpcval_array = array();
-			foreach($varargs as $parameter)
-			{
-				$xmlrpcval_array[] = php_xmlrpc_encode($parameter);
-			}
+            $xmlrpcval_array = array();
+            foreach($varargs as $parameter)
+            {
+                $xmlrpcval_array[] = php_xmlrpc_encode($parameter);
+            }
 
-			return $client->send(new xmlrpcmsg($remote_function_name, $xmlrpcval_array));
-		}
-	}
+            return $client->send(new xmlrpcmsg($remote_function_name, $xmlrpcval_array));
+        }
+    }
 ?>
diff --git a/demo/client/which.php b/demo/client/which.php
index 0699c8bb..bea011bd 100644
--- a/demo/client/which.php
+++ b/demo/client/which.php
@@ -1,32 +1 @@
-<html>

-<head><title>xmlrpc</title></head>

-<body>

-<h1>Which toolkit demo</h1>

-<h2>Query server for toolkit information</h2>

-<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>

-<?php

-	include("xmlrpc.inc");

-

-	$f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());

-	$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);

-	$r = $c->send($f);

-	if(!$r->faultCode())

-	{

-		$v = php_xmlrpc_decode($r->value());

-		print "<pre>";

-		print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";

-		print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";

-		print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";

-		print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";

-		print "</pre>";

-	}

-	else

-	{

-		print "An error occurred: ";

-		print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";

-	}

-?>

-<hr/>

-<em>$Id$</em>

-</body>

-</html>

+<html>

<head><title>xmlrpc</title></head>

<body>

<h1>Which toolkit demo</h1>

<h2>Query server for toolkit information</h2>

<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>

<?php

include("xmlrpc.inc");



    $f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());

    $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);

    $r = $c->send($f);

    if(!$r->faultCode())

    {

        $v = php_xmlrpc_decode($r->value());

        print "<pre>";

        print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";

        print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";

        print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";

        print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";

        print "</pre>";

    }

    else

    {

        print "An error occurred: ";

        print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";

    }

?>

<hr/>

<em>$Id$</em>

</body>

</html>

\ No newline at end of file
diff --git a/demo/client/wrap.php b/demo/client/wrap.php
index 6b4e005d..d91454eb 100644
--- a/demo/client/wrap.php
+++ b/demo/client/wrap.php
@@ -8,49 +8,49 @@
 2) wrapping of remote methods into php functions
 </h3>
 <?php
-	include("xmlrpc.inc");
-	include("xmlrpc_wrappers.inc");
+    include("xmlrpc.inc");
+    include("xmlrpc_wrappers.inc");
 
-	$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
-	$c->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
-	$r =& $c->send(new xmlrpcmsg('system.listMethods'));
-	if($r->faultCode())
-	{
-		echo "<p>Server methods list could not be retrieved: error '".htmlspecialchars($r->faultString())."'</p>\n";
-	}
-	else
-	{
-		$testcase = '';
-		echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n";
-		foreach($r->value() as $methodname) // $r->value is an array of strings
-		{
-			// do not wrap remote server system methods
-			if (strpos($methodname, 'system.') !== 0)
-			{
-				$funcname = wrap_xmlrpc_method($c, $methodname);
-				if($funcname)
-				{
-					echo "<li>Remote server method ".htmlspecialchars($methodname)." wrapped into php function ".$funcname."</li>\n";
-				}
-				else
-				{
-					echo "<li>Remote server method ".htmlspecialchars($methodname)." could not be wrapped!</li>\n";
-				}
-				if($methodname == 'examples.getStateName')
-				{
-					$testcase = $funcname;
-				}
-			}
-		}
-		echo "</ul>\n";
-		if($testcase)
-		{
-			echo "Now testing function $testcase: remote method to convert U.S. state number into state name";
-			$statenum = 25;
-			$statename = $testcase($statenum, 2);
-			echo "State number $statenum is ".htmlspecialchars($statename);
-		}
-	}
+    $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
+    $c->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
+    $r =& $c->send(new xmlrpcmsg('system.listMethods'));
+    if($r->faultCode())
+    {
+        echo "<p>Server methods list could not be retrieved: error '".htmlspecialchars($r->faultString())."'</p>\n";
+    }
+    else
+    {
+        $testcase = '';
+        echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n";
+        foreach($r->value() as $methodname) // $r->value is an array of strings
+        {
+            // do not wrap remote server system methods
+            if (strpos($methodname, 'system.') !== 0)
+            {
+                $funcname = wrap_xmlrpc_method($c, $methodname);
+                if($funcname)
+                {
+                    echo "<li>Remote server method ".htmlspecialchars($methodname)." wrapped into php function ".$funcname."</li>\n";
+                }
+                else
+                {
+                    echo "<li>Remote server method ".htmlspecialchars($methodname)." could not be wrapped!</li>\n";
+                }
+                if($methodname == 'examples.getStateName')
+                {
+                    $testcase = $funcname;
+                }
+            }
+        }
+        echo "</ul>\n";
+        if($testcase)
+        {
+            echo "Now testing function $testcase: remote method to convert U.S. state number into state name";
+            $statenum = 25;
+            $statename = $testcase($statenum, 2);
+            echo "State number $statenum is ".htmlspecialchars($statename);
+        }
+    }
 ?>
 <hr/>
 <em>$Id$</em>
diff --git a/demo/client/zopetest.php b/demo/client/zopetest.php
index 1029e01c..3ea4ee3a 100644
--- a/demo/client/zopetest.php
+++ b/demo/client/zopetest.php
@@ -4,26 +4,26 @@
 <h1>Zope test demo</h1>
 <h3>The code demonstrates usage of basic authentication to connect to the server</h3>
 <?php
-	include("xmlrpc.inc");
+    include("xmlrpc.inc");
 
-	$f = new xmlrpcmsg('document_src', array());
-	$c = new xmlrpc_client("/index_html", "pingu.heddley.com", 9080);
-	$c->setCredentials("username", "password");
-	$c->setDebug(2);
-	$r = $c->send($f);
-	if(!$r->faultCode())
-	{
-		$v = $r->value();
-		print "I received:" . htmlspecialchars($v->scalarval()) . "<br/>";
-		print "<hr/>I got this value back<br/>pre>" .
-		htmlentities($r->serialize()). "</pre>\n";
-	}
-	else
-	{
-		print "An error occurred: ";
-		print "Code: " . htmlspecialchars($r->faultCode())
-			. " Reason: '" . ($r->faultString()) . "'<br/>";
-	}
+    $f = new xmlrpcmsg('document_src', array());
+    $c = new xmlrpc_client("/index_html", "pingu.heddley.com", 9080);
+    $c->setCredentials("username", "password");
+    $c->setDebug(2);
+    $r = $c->send($f);
+    if(!$r->faultCode())
+    {
+        $v = $r->value();
+        print "I received:" . htmlspecialchars($v->scalarval()) . "<br/>";
+        print "<hr/>I got this value back<br/>pre>" .
+        htmlentities($r->serialize()). "</pre>\n";
+    }
+    else
+    {
+        print "An error occurred: ";
+        print "Code: " . htmlspecialchars($r->faultCode())
+            . " Reason: '" . ($r->faultString()) . "'<br/>";
+    }
 ?>
 <hr/>
 <em>$Id$</em>
diff --git a/demo/server/discuss.php b/demo/server/discuss.php
index 70723059..078b0877 100644
--- a/demo/server/discuss.php
+++ b/demo/server/discuss.php
@@ -1,124 +1,123 @@
 <?php
 
-	include("xmlrpc.inc");
-	include("xmlrpcs.inc");
+    include("xmlrpc.inc");
+    include("xmlrpcs.inc");
 
-	$addcomment_sig=array(array($xmlrpcInt, $xmlrpcString, $xmlrpcString, $xmlrpcString));
+    $addcomment_sig=array(array($xmlrpcInt, $xmlrpcString, $xmlrpcString, $xmlrpcString));
 
-	$addcomment_doc='Adds a comment to an item. The first parameter
+    $addcomment_doc='Adds a comment to an item. The first parameter
 is the item ID, the second the name of the commenter, and the third
 is the comment itself. Returns the number of comments against that
 ID.';
 
-	function addcomment($m)
-	{
-		global $xmlrpcerruser;
-		$err="";
-		// since validation has already been carried out for us,
-		// we know we got exactly 3 string values
-		$n = php_xmlrpc_decode($m);
-		$msgID = $n[0];
-		$name  = $n[1];
-		$comment = $n[2];
+    function addcomment($m)
+    {
+        global $xmlrpcerruser;
+        $err="";
+        // since validation has already been carried out for us,
+        // we know we got exactly 3 string values
+        $n = php_xmlrpc_decode($m);
+        $msgID = $n[0];
+        $name  = $n[1];
+        $comment = $n[2];
 
-		$dbh=dba_open("/tmp/comments.db", "c", "db2");
-		if($dbh)
-		{
-			$countID="${msgID}_count";
-			if(dba_exists($countID, $dbh))
-			{
-				$count=dba_fetch($countID, $dbh);
-			}
-			else
-			{
-				$count=0;
-			}
-			// add the new comment in
-			dba_insert($msgID . "_comment_${count}", $comment, $dbh);
-			dba_insert($msgID . "_name_${count}", $name, $dbh);
-			$count++;
-			dba_replace($countID, $count, $dbh);
-			dba_close($dbh);
-		}
-		else
-		{
-			$err="Unable to open comments database.";
-		}
-		// if we generated an error, create an error return response
-		if($err)
-		{
-			return new xmlrpcresp(0, $xmlrpcerruser, $err);
-		}
-		else
-		{
-			// otherwise, we create the right response
-			// with the state name
-			return new xmlrpcresp(new xmlrpcval($count, "int"));
-		}
-	}
+        $dbh=dba_open("/tmp/comments.db", "c", "db2");
+        if($dbh)
+        {
+            $countID="${msgID}_count";
+            if(dba_exists($countID, $dbh))
+            {
+                $count=dba_fetch($countID, $dbh);
+            }
+            else
+            {
+                $count=0;
+            }
+            // add the new comment in
+            dba_insert($msgID . "_comment_${count}", $comment, $dbh);
+            dba_insert($msgID . "_name_${count}", $name, $dbh);
+            $count++;
+            dba_replace($countID, $count, $dbh);
+            dba_close($dbh);
+        }
+        else
+        {
+            $err="Unable to open comments database.";
+        }
+        // if we generated an error, create an error return response
+        if($err)
+        {
+            return new xmlrpcresp(0, $xmlrpcerruser, $err);
+        }
+        else
+        {
+            // otherwise, we create the right response
+            // with the state name
+            return new xmlrpcresp(new xmlrpcval($count, "int"));
+        }
+    }
 
-	$getcomments_sig=array(array($xmlrpcArray, $xmlrpcString));
+    $getcomments_sig=array(array($xmlrpcArray, $xmlrpcString));
 
-	$getcomments_doc='Returns an array of comments for a given ID, which
+    $getcomments_doc='Returns an array of comments for a given ID, which
 is the sole argument. Each array item is a struct containing name
 and comment text.';
 
-	function getcomments($m)
-	{
-		global $xmlrpcerruser;
-		$err="";
-		$ra=array();
-		// get the first param
-		if(XMLRPC_EPI_ENABLED == '1')
-		{
-			$msgID=xmlrpc_decode($m->getParam(0));
-		}
-		else
-		{
-			$msgID=php_xmlrpc_decode($m->getParam(0));
-		}
-		$dbh=dba_open("/tmp/comments.db", "r", "db2");
-		if($dbh)
-		{
-			$countID="${msgID}_count";
-			if(dba_exists($countID, $dbh))
-			{
-				$count=dba_fetch($countID, $dbh);
-				for($i=0; $i<$count; $i++)
-				{
-					$name=dba_fetch("${msgID}_name_${i}", $dbh);
-					$comment=dba_fetch("${msgID}_comment_${i}", $dbh);
-					// push a new struct onto the return array
-					$ra[] = array(
-						"name" => $name,
-						"comment" => $comment
-						);
-				}
-			}
-		}
-		// if we generated an error, create an error return response
-		if($err)
-		{
-			return new xmlrpcresp(0, $xmlrpcerruser, $err);
-		}
-		else
-		{
-			// otherwise, we create the right response
-			// with the state name
-			return new xmlrpcresp(php_xmlrpc_encode($ra));
-		}
-	}
+    function getcomments($m)
+    {
+        global $xmlrpcerruser;
+        $err="";
+        $ra=array();
+        // get the first param
+        if(XMLRPC_EPI_ENABLED == '1')
+        {
+            $msgID=xmlrpc_decode($m->getParam(0));
+        }
+        else
+        {
+            $msgID=php_xmlrpc_decode($m->getParam(0));
+        }
+        $dbh=dba_open("/tmp/comments.db", "r", "db2");
+        if($dbh)
+        {
+            $countID="${msgID}_count";
+            if(dba_exists($countID, $dbh))
+            {
+                $count=dba_fetch($countID, $dbh);
+                for($i=0; $i<$count; $i++)
+                {
+                    $name=dba_fetch("${msgID}_name_${i}", $dbh);
+                    $comment=dba_fetch("${msgID}_comment_${i}", $dbh);
+                    // push a new struct onto the return array
+                    $ra[] = array(
+                        "name" => $name,
+                        "comment" => $comment
+                        );
+                }
+            }
+        }
+        // if we generated an error, create an error return response
+        if($err)
+        {
+            return new xmlrpcresp(0, $xmlrpcerruser, $err);
+        }
+        else
+        {
+            // otherwise, we create the right response
+            // with the state name
+            return new xmlrpcresp(php_xmlrpc_encode($ra));
+        }
+    }
 
-	$s = new xmlrpc_server(array(
-		"discuss.addComment" => array(
-			"function" => "addcomment",
-			"signature" => $addcomment_sig,
-			"docstring" => $addcomment_doc
-		),
-		"discuss.getComments" => array(
-			"function" => "getcomments",
-			"signature" => $getcomments_sig,
-			"docstring" => $getcomments_doc
-		)
-	));
-?>
+    $s = new xmlrpc_server(array(
+        "discuss.addComment" => array(
+            "function" => "addcomment",
+            "signature" => $addcomment_sig,
+            "docstring" => $addcomment_doc
+        ),
+        "discuss.getComments" => array(
+            "function" => "getcomments",
+            "signature" => $getcomments_sig,
+            "docstring" => $getcomments_doc
+        )
+    ));
diff --git a/demo/server/proxy.php b/demo/server/proxy.php
index 684be959..e9ecde54 100644
--- a/demo/server/proxy.php
+++ b/demo/server/proxy.php
@@ -9,77 +9,76 @@
  * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
  */
 
-	include("xmlrpc.inc");
-	include("xmlrpcs.inc");
+    include("xmlrpc.inc");
+    include("xmlrpcs.inc");
 
-	/**
-	* Forward an xmlrpc request to another server, and return to client the response received.
-	* @param xmlrpcmsg $m (see method docs below for a description of the expected parameters)
-	* @return xmlrpcresp
-	*/
-	function forward_request($m)
-	{
-		// create client
-		$timeout = 0;
-		$url = php_xmlrpc_decode($m->getParam(0));
-		$c = new xmlrpc_client($url);
-		if ($m->getNumParams() > 3)
-		{
-			// we have to set some options onto the client.
-			// Note that if we do not untaint the received values, warnings might be generated...
-			$options = php_xmlrpc_decode($m->getParam(3));
-			foreach($options as $key => $val)
-			{
-				switch($key)
-				{
-					case 'Cookie':
-						break;
-					case 'Credentials':
-						break;
-					case 'RequestCompression':
-						$c->setRequestCompression($val);
-						break;
-					case 'SSLVerifyHost':
-						$c->setSSLVerifyHost($val);
-						break;
-					case 'SSLVerifyPeer':
-						$c->setSSLVerifyPeer($val);
-						break;
-					case 'Timeout':
-						$timeout = (integer) $val;
-						break;
-				} // switch
-			}
-		}
+    /**
+    * Forward an xmlrpc request to another server, and return to client the response received.
+    * @param xmlrpcmsg $m (see method docs below for a description of the expected parameters)
+    * @return xmlrpcresp
+    */
+    function forward_request($m)
+    {
+        // create client
+        $timeout = 0;
+        $url = php_xmlrpc_decode($m->getParam(0));
+        $c = new xmlrpc_client($url);
+        if ($m->getNumParams() > 3)
+        {
+            // we have to set some options onto the client.
+            // Note that if we do not untaint the received values, warnings might be generated...
+            $options = php_xmlrpc_decode($m->getParam(3));
+            foreach($options as $key => $val)
+            {
+                switch($key)
+                {
+                    case 'Cookie':
+                        break;
+                    case 'Credentials':
+                        break;
+                    case 'RequestCompression':
+                        $c->setRequestCompression($val);
+                        break;
+                    case 'SSLVerifyHost':
+                        $c->setSSLVerifyHost($val);
+                        break;
+                    case 'SSLVerifyPeer':
+                        $c->setSSLVerifyPeer($val);
+                        break;
+                    case 'Timeout':
+                        $timeout = (integer) $val;
+                        break;
+                } // switch
+            }
+        }
 
-		// build call for remote server
-		/// @todo find a weay to forward client info (such as IP) to server, either
-		/// - as xml comments in the payload, or
-		/// - using std http header conventions, such as X-forwarded-for...
-		$method = php_xmlrpc_decode($m->getParam(1));
-		$pars = $m->getParam(2);
-		$m = new xmlrpcmsg($method);
-		for ($i = 0; $i < $pars->arraySize(); $i++)
-		{
-			$m->addParam($pars->arraymem($i));
-		}
+        // build call for remote server
+        /// @todo find a weay to forward client info (such as IP) to server, either
+        /// - as xml comments in the payload, or
+        /// - using std http header conventions, such as X-forwarded-for...
+        $method = php_xmlrpc_decode($m->getParam(1));
+        $pars = $m->getParam(2);
+        $m = new xmlrpcmsg($method);
+        for ($i = 0; $i < $pars->arraySize(); $i++)
+        {
+            $m->addParam($pars->arraymem($i));
+        }
 
-		// add debug info into response we give back to caller
-		xmlrpc_debugmsg("Sending to server $url the payload: ".$m->serialize());
-		return $c->send($m, $timeout);
-	}
+        // add debug info into response we give back to caller
+        xmlrpc_debugmsg("Sending to server $url the payload: ".$m->serialize());
+        return $c->send($m, $timeout);
+    }
 
-	// run the server
-	$server = new xmlrpc_server(
-		array(
-			'xmlrpcproxy.call' => array(
-				'function' => 'forward_request',
-				'signature' => array(
-					array('mixed', 'string', 'string', 'array'),
-					array('mixed', 'string', 'string', 'array', 'stuct'),
-				),
-				'docstring' => 'forwards xmlrpc calls to remote servers. Returns remote method\'s response. Accepts params: remote server url (might include basic auth credentials), method name, array of params, and (optionally) a struct containing call options'
-			)
-		)
-	);
-?>
+    // run the server
+    $server = new xmlrpc_server(
+        array(
+            'xmlrpcproxy.call' => array(
+                'function' => 'forward_request',
+                'signature' => array(
+                    array('mixed', 'string', 'string', 'array'),
+                    array('mixed', 'string', 'string', 'array', 'stuct'),
+                ),
+                'docstring' => 'forwards xmlrpc calls to remote servers. Returns remote method\'s response. Accepts params: remote server url (might include basic auth credentials), method name, array of params, and (optionally) a struct containing call options'
+            )
+        )
+    );
diff --git a/demo/server/server.php b/demo/server/server.php
index 45caf649..f44c2c79 100644
--- a/demo/server/server.php
+++ b/demo/server/server.php
@@ -13,322 +13,323 @@
 // give user a chance to see the source for this server instead of running the services
 if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource']))
 {
-	highlight_file(__FILE__);
-	die();
+    highlight_file(__FILE__);
+    die();
 }
 
-	include("xmlrpc.inc");
-	include("xmlrpcs.inc");
-	include("xmlrpc_wrappers.inc");
-
-	/**
-	* Used to test usage of object methods in dispatch maps and in wrapper code
-	*/
-	class xmlrpc_server_methods_container
-	{
-		/**
-		* Method used to test logging of php warnings generated by user functions.
-		*/
-		function phpwarninggenerator($m)
-		{
-			$a = $b; // this triggers a warning in E_ALL mode, since $b is undefined
-			return new xmlrpcresp(new xmlrpcval(1, 'boolean'));
-		}
-
-	    /**
-	     * Method used to testcatching of exceptions in the server.
-	     */
-	    function exceptiongenerator($m)
-	    {
-	        throw new Exception("it's just a test", 1);
-	    }
-
-		/**
-		* a PHP version of the state-number server. Send me an integer and i'll sell you a state
-		* @param integer $s
-		* @return string
-		*/
-		static function findstate($s)
-		{
-			return inner_findstate($s);
-		}
-	}
-
-
-	// a PHP version
-	// of the state-number server
-	// send me an integer and i'll sell you a state
-
-	$stateNames = array(
-		"Alabama", "Alaska", "Arizona", "Arkansas", "California",
-		"Colorado", "Columbia", "Connecticut", "Delaware", "Florida",
-		"Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas",
-		"Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan",
-		"Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada",
-		"New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina",
-		"North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island",
-		"South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont",
-		"Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"
-	);
-
-	$findstate_sig=array(array($xmlrpcString, $xmlrpcInt));
-	$findstate_doc='When passed an integer between 1 and 51 returns the
+    include("xmlrpc.inc");
+    include("xmlrpcs.inc");
+    include("xmlrpc_wrappers.inc");
+
+    /**
+    * Used to test usage of object methods in dispatch maps and in wrapper code
+    */
+    class xmlrpc_server_methods_container
+    {
+        /**
+        * Method used to test logging of php warnings generated by user functions.
+        */
+        function phpwarninggenerator($m)
+        {
+            $a = $b; // this triggers a warning in E_ALL mode, since $b is undefined
+            return new xmlrpcresp(new xmlrpcval(1, 'boolean'));
+        }
+
+        /**
+         * Method used to testcatching of exceptions in the server.
+         */
+        function exceptiongenerator($m)
+        {
+            throw new Exception("it's just a test", 1);
+        }
+
+        /**
+        * a PHP version of the state-number server. Send me an integer and i'll sell you a state
+        * @param integer $s
+        * @return string
+        */
+        static function findstate($s)
+        {
+            return inner_findstate($s);
+        }
+    }
+
+
+    // a PHP version
+    // of the state-number server
+    // send me an integer and i'll sell you a state
+
+    $stateNames = array(
+        "Alabama", "Alaska", "Arizona", "Arkansas", "California",
+        "Colorado", "Columbia", "Connecticut", "Delaware", "Florida",
+        "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas",
+        "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan",
+        "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada",
+        "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina",
+        "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island",
+        "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont",
+        "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"
+    );
+
+    $findstate_sig=array(array($xmlrpcString, $xmlrpcInt));
+    $findstate_doc='When passed an integer between 1 and 51 returns the
 name of a US state, where the integer is the index of that state name
 in an alphabetic order.';
 
 
-	function findstate($m)
-	{
-		global $xmlrpcerruser, $stateNames;
-		$err="";
-		// get the first param
-		$sno=$m->getParam(0);
-
-		// param must be there and of the correct type: server object does the
-		// validation for us
-
-		// extract the value of the state number
-		$snv=$sno->scalarval();
-		// look it up in our array (zero-based)
-		if (isset($stateNames[$snv-1]))
-		{
-			$sname=$stateNames[$snv-1];
-		}
-		else
-		{
-			// not, there so complain
-			$err="I don't have a state for the index '" . $snv . "'";
-		}
-
-		// if we generated an error, create an error return response
-		if ($err)
-		{
-			return new xmlrpcresp(0, $xmlrpcerruser, $err);
-		}
-		else
-		{
-			// otherwise, we create the right response
-			// with the state name
-			return new xmlrpcresp(new xmlrpcval($sname));
-		}
-	}
-
-	/**
-	* Inner code of the state-number server.
-	* Used to test auto-registration of PHP funcions as xmlrpc methods.
-	* @param integer $stateno the state number
-	* @return string the name of the state (or error descrption)
-	*/
-	function inner_findstate($stateno)
-	{
-		global $stateNames;
-		if (isset($stateNames[$stateno-1]))
-		{
-			return $stateNames[$stateno-1];
-		}
-		else
-		{
-			// not, there so complain
-			return "I don't have a state for the index '" . $stateno . "'";
-		}
-	}
-	$findstate2_sig = wrap_php_function('inner_findstate');
-
-	$findstate3_sig = wrap_php_function(array('xmlrpc_server_methods_container', 'findstate'));
-
-	$findstate5_sig = wrap_php_function('xmlrpc_server_methods_container::findstate');
-
-	$obj = new xmlrpc_server_methods_container();
-	$findstate4_sig = wrap_php_function(array($obj, 'findstate'));
-
-	$addtwo_sig=array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcInt));
-	$addtwo_doc='Add two integers together and return the result';
-	function addtwo($m)
-	{
-		$s=$m->getParam(0);
-		$t=$m->getParam(1);
-		return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(),"int"));
-	}
-
-	$addtwodouble_sig=array(array($xmlrpcDouble, $xmlrpcDouble, $xmlrpcDouble));
-	$addtwodouble_doc='Add two doubles together and return the result';
-	function addtwodouble($m)
-	{
-		$s=$m->getParam(0);
-		$t=$m->getParam(1);
-		return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(),"double"));
-	}
-
-	$stringecho_sig=array(array($xmlrpcString, $xmlrpcString));
-	$stringecho_doc='Accepts a string parameter, returns the string.';
-	function stringecho($m)
-	{
-		// just sends back a string
-		$s=$m->getParam(0);
-		$v = $s->scalarval();
-		return new xmlrpcresp(new xmlrpcval($s->scalarval()));
-	}
-
-	$echoback_sig=array(array($xmlrpcString, $xmlrpcString));
-	$echoback_doc='Accepts a string parameter, returns the entire incoming payload';
-	function echoback($m)
-	{
-		// just sends back a string with what i got
-		// sent to me, just escaped, that's all
-		//
-		// $m is an incoming message
-		$s="I got the following message:\n" . $m->serialize();
-		return new xmlrpcresp(new xmlrpcval($s));
-	}
-
-	$echosixtyfour_sig=array(array($xmlrpcString, $xmlrpcBase64));
-	$echosixtyfour_doc='Accepts a base64 parameter and returns it decoded as a string';
-	function echosixtyfour($m)
-	{
-		// accepts an encoded value, but sends it back
-		// as a normal string. this is to test base64 encoding
-		// is working as expected
-		$incoming=$m->getParam(0);
-		return new xmlrpcresp(new xmlrpcval($incoming->scalarval(), "string"));
-	}
-
-	$bitflipper_sig=array(array($xmlrpcArray, $xmlrpcArray));
-	$bitflipper_doc='Accepts an array of booleans, and returns them inverted';
-	function bitflipper($m)
-	{
-		global $xmlrpcArray;
-
-		$v=$m->getParam(0);
-		$sz=$v->arraysize();
-		$rv=new xmlrpcval(array(), $xmlrpcArray);
-
-		for($j=0; $j<$sz; $j++)
-		{
-			$b=$v->arraymem($j);
-			if ($b->scalarval())
-			{
-				$rv->addScalar(false, "boolean");
-			}
-			else
-			{
-				$rv->addScalar(true, "boolean");
-			}
-		}
-
-		return new xmlrpcresp($rv);
-	}
-
-	// Sorting demo
-	//
-	// send me an array of structs thus:
-	//
-	// Dave 35
-	// Edd  45
-	// Fred 23
-	// Barney 37
-	//
-	// and I'll return it to you in sorted order
-
-	function agesorter_compare($a, $b)
-	{
-		global $agesorter_arr;
-
-		// don't even ask me _why_ these come padded with
-		// hyphens, I couldn't tell you :p
-		$a=str_replace("-", "", $a);
-		$b=str_replace("-", "", $b);
-
-		if ($agesorter_arr[$a]==$agesorter[$b])
-		{
-			return 0;
-		}
-		return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1;
-	}
-
-	$agesorter_sig=array(array($xmlrpcArray, $xmlrpcArray));
-	$agesorter_doc='Send this method an array of [string, int] structs, eg:
+    function findstate($m)
+    {
+        global $xmlrpcerruser, $stateNames;
+        $err="";
+        // get the first param
+        $sno=$m->getParam(0);
+
+        // param must be there and of the correct type: server object does the
+        // validation for us
+
+        // extract the value of the state number
+        $snv=$sno->scalarval();
+        // look it up in our array (zero-based)
+        if (isset($stateNames[$snv-1]))
+        {
+            $sname=$stateNames[$snv-1];
+        }
+        else
+        {
+            // not, there so complain
+            $err="I don't have a state for the index '" . $snv . "'";
+        }
+
+        // if we generated an error, create an error return response
+        if ($err)
+        {
+            return new xmlrpcresp(0, $xmlrpcerruser, $err);
+        }
+        else
+        {
+            // otherwise, we create the right response
+            // with the state name
+            return new xmlrpcresp(new xmlrpcval($sname));
+        }
+    }
+
+    /**
+    * Inner code of the state-number server.
+    * Used to test auto-registration of PHP funcions as xmlrpc methods.
+    * @param integer $stateno the state number
+    * @return string the name of the state (or error descrption)
+    */
+    function inner_findstate($stateno)
+    {
+        global $stateNames;
+        if (isset($stateNames[$stateno-1]))
+        {
+            return $stateNames[$stateno-1];
+        }
+        else
+        {
+            // not, there so complain
+            return "I don't have a state for the index '" . $stateno . "'";
+        }
+    }
+    $findstate2_sig = wrap_php_function('inner_findstate');
+
+    $findstate3_sig = wrap_php_function(array('xmlrpc_server_methods_container', 'findstate'));
+
+    $findstate5_sig = wrap_php_function('xmlrpc_server_methods_container::findstate');
+
+    $obj = new xmlrpc_server_methods_container();
+    $findstate4_sig = wrap_php_function(array($obj, 'findstate'));
+
+    $addtwo_sig=array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcInt));
+    $addtwo_doc='Add two integers together and return the result';
+    function addtwo($m)
+    {
+        $s=$m->getParam(0);
+        $t=$m->getParam(1);
+        return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(),"int"));
+    }
+
+    $addtwodouble_sig=array(array($xmlrpcDouble, $xmlrpcDouble, $xmlrpcDouble));
+    $addtwodouble_doc='Add two doubles together and return the result';
+    function addtwodouble($m)
+    {
+        $s=$m->getParam(0);
+        $t=$m->getParam(1);
+        return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(),"double"));
+    }
+
+    $stringecho_sig=array(array($xmlrpcString, $xmlrpcString));
+    $stringecho_doc='Accepts a string parameter, returns the string.';
+    function stringecho($m)
+    {
+        // just sends back a string
+        $s=$m->getParam(0);
+        $v = $s->scalarval();
+file_put_contents('D:/temp/zozzo.log', $v, FILE_APPEND);
+        return new xmlrpcresp(new xmlrpcval($s->scalarval()));
+    }
+
+    $echoback_sig=array(array($xmlrpcString, $xmlrpcString));
+    $echoback_doc='Accepts a string parameter, returns the entire incoming payload';
+    function echoback($m)
+    {
+        // just sends back a string with what i got
+        // sent to me, just escaped, that's all
+        //
+        // $m is an incoming message
+        $s="I got the following message:\n" . $m->serialize();
+        return new xmlrpcresp(new xmlrpcval($s));
+    }
+
+    $echosixtyfour_sig=array(array($xmlrpcString, $xmlrpcBase64));
+    $echosixtyfour_doc='Accepts a base64 parameter and returns it decoded as a string';
+    function echosixtyfour($m)
+    {
+        // accepts an encoded value, but sends it back
+        // as a normal string. this is to test base64 encoding
+        // is working as expected
+        $incoming=$m->getParam(0);
+        return new xmlrpcresp(new xmlrpcval($incoming->scalarval(), "string"));
+    }
+
+    $bitflipper_sig=array(array($xmlrpcArray, $xmlrpcArray));
+    $bitflipper_doc='Accepts an array of booleans, and returns them inverted';
+    function bitflipper($m)
+    {
+        global $xmlrpcArray;
+
+        $v=$m->getParam(0);
+        $sz=$v->arraysize();
+        $rv=new xmlrpcval(array(), $xmlrpcArray);
+
+        for($j=0; $j<$sz; $j++)
+        {
+            $b=$v->arraymem($j);
+            if ($b->scalarval())
+            {
+                $rv->addScalar(false, "boolean");
+            }
+            else
+            {
+                $rv->addScalar(true, "boolean");
+            }
+        }
+
+        return new xmlrpcresp($rv);
+    }
+
+    // Sorting demo
+    //
+    // send me an array of structs thus:
+    //
+    // Dave 35
+    // Edd  45
+    // Fred 23
+    // Barney 37
+    //
+    // and I'll return it to you in sorted order
+
+    function agesorter_compare($a, $b)
+    {
+        global $agesorter_arr;
+
+        // don't even ask me _why_ these come padded with
+        // hyphens, I couldn't tell you :p
+        $a=str_replace("-", "", $a);
+        $b=str_replace("-", "", $b);
+
+        if ($agesorter_arr[$a]==$agesorter[$b])
+        {
+            return 0;
+        }
+        return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1;
+    }
+
+    $agesorter_sig=array(array($xmlrpcArray, $xmlrpcArray));
+    $agesorter_doc='Send this method an array of [string, int] structs, eg:
 <pre>
  Dave   35
- Edd	45
+ Edd    45
  Fred   23
  Barney 37
 </pre>
 And the array will be returned with the entries sorted by their numbers.
 ';
-	function agesorter($m)
-	{
-		global $agesorter_arr, $xmlrpcerruser, $s;
-
-		xmlrpc_debugmsg("Entering 'agesorter'");
-		// get the parameter
-		$sno=$m->getParam(0);
-		// error string for [if|when] things go wrong
-		$err="";
-		// create the output value
-		$v=new xmlrpcval();
-		$agar=array();
-
-		if (isset($sno) && $sno->kindOf()=="array")
-		{
-			$max=$sno->arraysize();
-			// TODO: create debug method to print can work once more
-			// print "<!-- found $max array elements -->\n";
-			for($i=0; $i<$max; $i++)
-			{
-				$rec=$sno->arraymem($i);
-				if ($rec->kindOf()!="struct")
-				{
-					$err="Found non-struct in array at element $i";
-					break;
-				}
-				// extract name and age from struct
-				$n=$rec->structmem("name");
-				$a=$rec->structmem("age");
-				// $n and $a are xmlrpcvals,
-				// so get the scalarval from them
-				$agar[$n->scalarval()]=$a->scalarval();
-			}
-
-			$agesorter_arr=$agar;
-			// hack, must make global as uksort() won't
-			// allow us to pass any other auxilliary information
-			uksort($agesorter_arr, agesorter_compare);
-			$outAr=array();
-			while (list( $key, $val ) = each( $agesorter_arr ) )
-			{
-				// recreate each struct element
-				$outAr[]=new xmlrpcval(array("name" =>
-				new xmlrpcval($key),
-				"age" =>
-				new xmlrpcval($val, "int")), "struct");
-			}
-			// add this array to the output value
-			$v->addArray($outAr);
-		}
-		else
-		{
-			$err="Must be one parameter, an array of structs";
-		}
-
-		if ($err)
-		{
-			return new xmlrpcresp(0, $xmlrpcerruser, $err);
-		}
-		else
-		{
-			return new xmlrpcresp($v);
-		}
-	}
-
-	// signature and instructions, place these in the dispatch
-	// map
-	$mail_send_sig=array(array(
-		$xmlrpcBoolean, $xmlrpcString, $xmlrpcString,
-		$xmlrpcString, $xmlrpcString, $xmlrpcString,
-		$xmlrpcString, $xmlrpcString
-	));
-
-	$mail_send_doc='mail.send(recipient, subject, text, sender, cc, bcc, mimetype)<br/>
+    function agesorter($m)
+    {
+        global $agesorter_arr, $xmlrpcerruser, $s;
+
+        xmlrpc_debugmsg("Entering 'agesorter'");
+        // get the parameter
+        $sno=$m->getParam(0);
+        // error string for [if|when] things go wrong
+        $err="";
+        // create the output value
+        $v=new xmlrpcval();
+        $agar=array();
+
+        if (isset($sno) && $sno->kindOf()=="array")
+        {
+            $max=$sno->arraysize();
+            // TODO: create debug method to print can work once more
+            // print "<!-- found $max array elements -->\n";
+            for($i=0; $i<$max; $i++)
+            {
+                $rec=$sno->arraymem($i);
+                if ($rec->kindOf()!="struct")
+                {
+                    $err="Found non-struct in array at element $i";
+                    break;
+                }
+                // extract name and age from struct
+                $n=$rec->structmem("name");
+                $a=$rec->structmem("age");
+                // $n and $a are xmlrpcvals,
+                // so get the scalarval from them
+                $agar[$n->scalarval()]=$a->scalarval();
+            }
+
+            $agesorter_arr=$agar;
+            // hack, must make global as uksort() won't
+            // allow us to pass any other auxilliary information
+            uksort($agesorter_arr, agesorter_compare);
+            $outAr=array();
+            while (list( $key, $val ) = each( $agesorter_arr ) )
+            {
+                // recreate each struct element
+                $outAr[]=new xmlrpcval(array("name" =>
+                new xmlrpcval($key),
+                "age" =>
+                new xmlrpcval($val, "int")), "struct");
+            }
+            // add this array to the output value
+            $v->addArray($outAr);
+        }
+        else
+        {
+            $err="Must be one parameter, an array of structs";
+        }
+
+        if ($err)
+        {
+            return new xmlrpcresp(0, $xmlrpcerruser, $err);
+        }
+        else
+        {
+            return new xmlrpcresp($v);
+        }
+    }
+
+    // signature and instructions, place these in the dispatch
+    // map
+    $mail_send_sig=array(array(
+        $xmlrpcBoolean, $xmlrpcString, $xmlrpcString,
+        $xmlrpcString, $xmlrpcString, $xmlrpcString,
+        $xmlrpcString, $xmlrpcString
+    ));
+
+    $mail_send_doc='mail.send(recipient, subject, text, sender, cc, bcc, mimetype)<br/>
 recipient, cc, and bcc are strings, comma-separated lists of email addresses, as described above.<br/>
 subject is a string, the subject of the message.<br/>
 sender is a string, it\'s the email address of the person sending the message. This string can not be
@@ -336,517 +337,516 @@ a comma-separated list, it must contain a single email address only.<br/>
 text is a string, it contains the body of the message.<br/>
 mimetype, a string, is a standard MIME type, for example, text/plain.
 ';
-	// WARNING; this functionality depends on the sendmail -t option
-	// it may not work with Windows machines properly; particularly
-	// the Bcc option. Sneak on your friends at your own risk!
-	function mail_send($m)
-	{
-		global $xmlrpcerruser, $xmlrpcBoolean;
-		$err="";
-
-		$mTo=$m->getParam(0);
-		$mSub=$m->getParam(1);
-		$mBody=$m->getParam(2);
-		$mFrom=$m->getParam(3);
-		$mCc=$m->getParam(4);
-		$mBcc=$m->getParam(5);
-		$mMime=$m->getParam(6);
-
-		if ($mTo->scalarval()=="")
-		{
-			$err="Error, no 'To' field specified";
-		}
-
-		if ($mFrom->scalarval()=="")
-		{
-			$err="Error, no 'From' field specified";
-		}
-
-		$msghdr="From: " . $mFrom->scalarval() . "\n";
-		$msghdr.="To: ". $mTo->scalarval() . "\n";
-
-		if ($mCc->scalarval()!="")
-		{
-			$msghdr.="Cc: " . $mCc->scalarval(). "\n";
-		}
-		if ($mBcc->scalarval()!="")
-		{
-			$msghdr.="Bcc: " . $mBcc->scalarval(). "\n";
-		}
-		if ($mMime->scalarval()!="")
-		{
-			$msghdr.="Content-type: " . $mMime->scalarval() . "\n";
-		}
-		$msghdr.="X-Mailer: XML-RPC for PHP mailer 1.0";
-
-		if ($err=="")
-		{
-			if (!mail("",
-				$mSub->scalarval(),
-				$mBody->scalarval(),
-				$msghdr))
-			{
-				$err="Error, could not send the mail.";
-			}
-		}
-
-		if ($err)
-		{
-			return new xmlrpcresp(0, $xmlrpcerruser, $err);
-		}
-		else
-		{
-			return new xmlrpcresp(new xmlrpcval("true", $xmlrpcBoolean));
-		}
-	}
-
-	$getallheaders_sig=array(array($xmlrpcStruct));
-	$getallheaders_doc='Returns a struct containing all the HTTP headers received with the request. Provides limited functionality with IIS';
-	function getallheaders_xmlrpc($m)
-	{
-		global $xmlrpcerruser;
-		if (function_exists('getallheaders'))
-		{
-			return new xmlrpcresp(php_xmlrpc_encode(getallheaders()));
-		}
-		else
-		{
-			$headers = array();
-			// IIS: poor man's version of getallheaders
-			foreach ($_SERVER as $key => $val)
-				if (strpos($key, 'HTTP_') === 0)
-				{
-					$key = ucfirst(str_replace('_', '-', strtolower(substr($key, 5))));
-					$headers[$key] = $val;
-				}
-			return new xmlrpcresp(php_xmlrpc_encode($headers));
-		}
-	}
-
-	$setcookies_sig=array(array($xmlrpcInt, $xmlrpcStruct));
-	$setcookies_doc='Sends to client a response containing a single \'1\' digit, and sets to it http cookies as received in the request (array of structs describing a cookie)';
-	function setcookies($m)
-	{
-		$m = $m->getParam(0);
-		while(list($name,$value) = $m->structeach())
-		{
-			$cookiedesc = php_xmlrpc_decode($value);
-			setcookie($name, @$cookiedesc['value'], @$cookiedesc['expires'], @$cookiedesc['path'], @$cookiedesc['domain'], @$cookiedesc['secure']);
-		}
-		return new xmlrpcresp(new xmlrpcval(1, 'int'));
-	}
-
-	$getcookies_sig=array(array($xmlrpcStruct));
-	$getcookies_doc='Sends to client a response containing all http cookies as received in the request (as struct)';
-	function getcookies($m)
-	{
-		return new xmlrpcresp(php_xmlrpc_encode($_COOKIE));
-	}
-
-	$v1_arrayOfStructs_sig=array(array($xmlrpcInt, $xmlrpcArray));
-	$v1_arrayOfStructs_doc='This handler takes a single parameter, an array of structs, each of which contains at least three elements named moe, larry and curly, all <i4>s. Your handler must add all the struct elements named curly and return the result.';
-	function v1_arrayOfStructs($m)
-	{
-		$sno=$m->getParam(0);
-		$numcurly=0;
-		for($i=0; $i<$sno->arraysize(); $i++)
-		{
-			$str=$sno->arraymem($i);
-			$str->structreset();
-			while(list($key,$val)=$str->structeach())
-			{
-				if ($key=="curly")
-				{
-					$numcurly+=$val->scalarval();
-				}
-			}
-		}
-		return new xmlrpcresp(new xmlrpcval($numcurly, "int"));
-	}
-
-	$v1_easyStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct));
-	$v1_easyStruct_doc='This handler takes a single parameter, a struct, containing at least three elements named moe, larry and curly, all &lt;i4&gt;s. Your handler must add the three numbers and return the result.';
-	function v1_easyStruct($m)
-	{
-		$sno=$m->getParam(0);
-		$moe=$sno->structmem("moe");
-		$larry=$sno->structmem("larry");
-		$curly=$sno->structmem("curly");
-		$num=$moe->scalarval() + $larry->scalarval() + $curly->scalarval();
-		return new xmlrpcresp(new xmlrpcval($num, "int"));
-	}
-
-	$v1_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct));
-	$v1_echoStruct_doc='This handler takes a single parameter, a struct. Your handler must return the struct.';
-	function v1_echoStruct($m)
-	{
-		$sno=$m->getParam(0);
-		return new xmlrpcresp($sno);
-	}
-
-	$v1_manyTypes_sig=array(array(
-		$xmlrpcArray, $xmlrpcInt, $xmlrpcBoolean,
-		$xmlrpcString, $xmlrpcDouble, $xmlrpcDateTime,
-		$xmlrpcBase64
-	));
-	$v1_manyTypes_doc='This handler takes six parameters, and returns an array containing all the parameters.';
-	function v1_manyTypes($m)
-	{
-		return new xmlrpcresp(new xmlrpcval(array(
-			$m->getParam(0),
-			$m->getParam(1),
-			$m->getParam(2),
-			$m->getParam(3),
-			$m->getParam(4),
-			$m->getParam(5)),
-			"array"
-		));
-	}
-
-	$v1_moderateSizeArrayCheck_sig=array(array($xmlrpcString, $xmlrpcArray));
-	$v1_moderateSizeArrayCheck_doc='This handler takes a single parameter, which is an array containing between 100 and 200 elements. Each of the items is a string, your handler must return a string containing the concatenated text of the first and last elements.';
-	function v1_moderateSizeArrayCheck($m)
-	{
-		$ar=$m->getParam(0);
-		$sz=$ar->arraysize();
-		$first=$ar->arraymem(0);
-		$last=$ar->arraymem($sz-1);
-		return new xmlrpcresp(new xmlrpcval($first->scalarval() .
-		$last->scalarval(), "string"));
-	}
-
-	$v1_simpleStructReturn_sig=array(array($xmlrpcStruct, $xmlrpcInt));
-	$v1_simpleStructReturn_doc='This handler takes one parameter, and returns a struct containing three elements, times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.';
-	function v1_simpleStructReturn($m)
-	{
-		$sno=$m->getParam(0);
-		$v=$sno->scalarval();
-		return new xmlrpcresp(new xmlrpcval(array(
-			"times10"   => new xmlrpcval($v*10, "int"),
-			"times100"  => new xmlrpcval($v*100, "int"),
-			"times1000" => new xmlrpcval($v*1000, "int")),
-			"struct"
-		));
-	}
-
-	$v1_nestedStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct));
-	$v1_nestedStruct_doc='This handler takes a single parameter, a struct, that models a daily calendar. At the top level, there is one struct for each year. Each year is broken down into months, and months into days. Most of the days are empty in the struct you receive, but the entry for April 1, 2000 contains a least three elements named moe, larry and curly, all &lt;i4&gt;s. Your handler must add the three numbers and return the result.';
-	function v1_nestedStruct($m)
-	{
-		$sno=$m->getParam(0);
-
-		$twoK=$sno->structmem("2000");
-		$april=$twoK->structmem("04");
-		$fools=$april->structmem("01");
-		$curly=$fools->structmem("curly");
-		$larry=$fools->structmem("larry");
-		$moe=$fools->structmem("moe");
-		return new xmlrpcresp(new xmlrpcval($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), "int"));
-	}
-
-	$v1_countTheEntities_sig=array(array($xmlrpcStruct, $xmlrpcString));
-	$v1_countTheEntities_doc='This handler takes a single parameter, a string, that contains any number of predefined entities, namely &lt;, &gt;, &amp; \' and ".<BR>Your handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets, ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.';
-	function v1_countTheEntities($m)
-	{
-		$sno=$m->getParam(0);
-		$str=$sno->scalarval();
-		$gt=0; $lt=0; $ap=0; $qu=0; $amp=0;
-		for($i=0; $i<strlen($str); $i++)
-		{
-			$c=substr($str, $i, 1);
-			switch($c)
-			{
-				case ">":
-					$gt++;
-					break;
-				case "<":
-					$lt++;
-					break;
-				case "\"":
-					$qu++;
-					break;
-				case "'":
-					$ap++;
-					break;
-				case "&":
-					$amp++;
-					break;
-				default:
-					break;
-			}
-		}
-		return new xmlrpcresp(new xmlrpcval(array(
-			"ctLeftAngleBrackets"  => new xmlrpcval($lt, "int"),
-			"ctRightAngleBrackets" => new xmlrpcval($gt, "int"),
-			"ctAmpersands"		 => new xmlrpcval($amp, "int"),
-			"ctApostrophes"		=> new xmlrpcval($ap, "int"),
-			"ctQuotes"			 => new xmlrpcval($qu, "int")),
-			"struct"
-		));
-	}
-
-	// trivial interop tests
-	// http://www.xmlrpc.com/stories/storyReader$1636
-
-	$i_echoString_sig=array(array($xmlrpcString, $xmlrpcString));
-	$i_echoString_doc="Echoes string.";
-
-	$i_echoStringArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
-	$i_echoStringArray_doc="Echoes string array.";
-
-	$i_echoInteger_sig=array(array($xmlrpcInt, $xmlrpcInt));
-	$i_echoInteger_doc="Echoes integer.";
-
-	$i_echoIntegerArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
-	$i_echoIntegerArray_doc="Echoes integer array.";
-
-	$i_echoFloat_sig=array(array($xmlrpcDouble, $xmlrpcDouble));
-	$i_echoFloat_doc="Echoes float.";
-
-	$i_echoFloatArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
-	$i_echoFloatArray_doc="Echoes float array.";
-
-	$i_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct));
-	$i_echoStruct_doc="Echoes struct.";
-
-	$i_echoStructArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
-	$i_echoStructArray_doc="Echoes struct array.";
-
-	$i_echoValue_doc="Echoes any value back.";
-	$i_echoValue_sig=array(array($xmlrpcValue, $xmlrpcValue));
-
-	$i_echoBase64_sig=array(array($xmlrpcBase64, $xmlrpcBase64));
-	$i_echoBase64_doc="Echoes base64.";
-
-	$i_echoDate_sig=array(array($xmlrpcDateTime, $xmlrpcDateTime));
-	$i_echoDate_doc="Echoes dateTime.";
-
-	function i_echoParam($m)
-	{
-		$s=$m->getParam(0);
-		return new xmlrpcresp($s);
-	}
-
-	function i_echoString($m) { return i_echoParam($m); }
-	function i_echoInteger($m) { return i_echoParam($m); }
-	function i_echoFloat($m) { return i_echoParam($m); }
-	function i_echoStruct($m) { return i_echoParam($m); }
-	function i_echoStringArray($m) { return i_echoParam($m); }
-	function i_echoIntegerArray($m) { return i_echoParam($m); }
-	function i_echoFloatArray($m) { return i_echoParam($m); }
-	function i_echoStructArray($m) { return i_echoParam($m); }
-	function i_echoValue($m) { return i_echoParam($m); }
-	function i_echoBase64($m) { return i_echoParam($m); }
-	function i_echoDate($m) { return i_echoParam($m); }
-
-	$i_whichToolkit_sig=array(array($xmlrpcStruct));
-	$i_whichToolkit_doc="Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem.";
-
-	function i_whichToolkit($m)
-	{
-		global $xmlrpcName, $xmlrpcVersion,$SERVER_SOFTWARE;
-		$ret=array(
-			"toolkitDocsUrl" => "http://phpxmlrpc.sourceforge.net/",
-			"toolkitName" => $xmlrpcName,
-			"toolkitVersion" => $xmlrpcVersion,
-			"toolkitOperatingSystem" => isset ($SERVER_SOFTWARE) ? $SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE']
-		);
-		return new xmlrpcresp ( php_xmlrpc_encode($ret));
-	}
-
-	$o=new xmlrpc_server_methods_container;
-	$a=array(
-		"examples.getStateName" => array(
-			"function" => "findstate",
-			"signature" => $findstate_sig,
-			"docstring" => $findstate_doc
-		),
-		"examples.sortByAge" => array(
-			"function" => "agesorter",
-			"signature" => $agesorter_sig,
-			"docstring" => $agesorter_doc
-		),
-		"examples.addtwo" => array(
-			"function" => "addtwo",
-			"signature" => $addtwo_sig,
-			"docstring" => $addtwo_doc
-		),
-		"examples.addtwodouble" => array(
-			"function" => "addtwodouble",
-			"signature" => $addtwodouble_sig,
-			"docstring" => $addtwodouble_doc
-		),
-		"examples.stringecho" => array(
-			"function" => "stringecho",
-			"signature" => $stringecho_sig,
-			"docstring" => $stringecho_doc
-		),
-		"examples.echo" => array(
-			"function" => "echoback",
-			"signature" => $echoback_sig,
-			"docstring" => $echoback_doc
-		),
-		"examples.decode64" => array(
-			"function" => "echosixtyfour",
-			"signature" => $echosixtyfour_sig,
-			"docstring" => $echosixtyfour_doc
-		),
-		"examples.invertBooleans" => array(
-			"function" => "bitflipper",
-			"signature" => $bitflipper_sig,
-			"docstring" => $bitflipper_doc
-		),
-		"examples.generatePHPWarning" => array(
-			"function" => array($o, "phpwarninggenerator")
-			//'function' => 'xmlrpc_server_methods_container::phpwarninggenerator'
-		),
-		"examples.raiseException" => array(
-			"function" => array($o, "exceptiongenerator")
-		),
-		"examples.getallheaders" => array(
-			"function" => 'getallheaders_xmlrpc',
-			"signature" => $getallheaders_sig,
-			"docstring" => $getallheaders_doc
-		),
-		"examples.setcookies" => array(
-			"function" => 'setcookies',
-			"signature" => $setcookies_sig,
-			"docstring" => $setcookies_doc
-		),
-		"examples.getcookies" => array(
-			"function" => 'getcookies',
-			"signature" => $getcookies_sig,
-			"docstring" => $getcookies_doc
-		),
-		"mail.send" => array(
-			"function" => "mail_send",
-			"signature" => $mail_send_sig,
-			"docstring" => $mail_send_doc
-		),
-		"validator1.arrayOfStructsTest" => array(
-			"function" => "v1_arrayOfStructs",
-			"signature" => $v1_arrayOfStructs_sig,
-			"docstring" => $v1_arrayOfStructs_doc
-		),
-		"validator1.easyStructTest" => array(
-			"function" => "v1_easyStruct",
-			"signature" => $v1_easyStruct_sig,
-			"docstring" => $v1_easyStruct_doc
-		),
-		"validator1.echoStructTest" => array(
-			"function" => "v1_echoStruct",
-			"signature" => $v1_echoStruct_sig,
-			"docstring" => $v1_echoStruct_doc
-		),
-		"validator1.manyTypesTest" => array(
-			"function" => "v1_manyTypes",
-			"signature" => $v1_manyTypes_sig,
-			"docstring" => $v1_manyTypes_doc
-		),
-		"validator1.moderateSizeArrayCheck" => array(
-			"function" => "v1_moderateSizeArrayCheck",
-			"signature" => $v1_moderateSizeArrayCheck_sig,
-			"docstring" => $v1_moderateSizeArrayCheck_doc
-		),
-		"validator1.simpleStructReturnTest" => array(
-			"function" => "v1_simpleStructReturn",
-			"signature" => $v1_simpleStructReturn_sig,
-			"docstring" => $v1_simpleStructReturn_doc
-		),
-		"validator1.nestedStructTest" => array(
-			"function" => "v1_nestedStruct",
-			"signature" => $v1_nestedStruct_sig,
-			"docstring" => $v1_nestedStruct_doc
-		),
-		"validator1.countTheEntities" => array(
-			"function" => "v1_countTheEntities",
-			"signature" => $v1_countTheEntities_sig,
-			"docstring" => $v1_countTheEntities_doc
-		),
-		"interopEchoTests.echoString" => array(
-			"function" => "i_echoString",
-			"signature" => $i_echoString_sig,
-			"docstring" => $i_echoString_doc
-		),
-		"interopEchoTests.echoStringArray" => array(
-			"function" => "i_echoStringArray",
-			"signature" => $i_echoStringArray_sig,
-			"docstring" => $i_echoStringArray_doc
-		),
-		"interopEchoTests.echoInteger" => array(
-			"function" => "i_echoInteger",
-			"signature" => $i_echoInteger_sig,
-			"docstring" => $i_echoInteger_doc
-		),
-		"interopEchoTests.echoIntegerArray" => array(
-			"function" => "i_echoIntegerArray",
-			"signature" => $i_echoIntegerArray_sig,
-			"docstring" => $i_echoIntegerArray_doc
-		),
-		"interopEchoTests.echoFloat" => array(
-			"function" => "i_echoFloat",
-			"signature" => $i_echoFloat_sig,
-			"docstring" => $i_echoFloat_doc
-		),
-		"interopEchoTests.echoFloatArray" => array(
-			"function" => "i_echoFloatArray",
-			"signature" => $i_echoFloatArray_sig,
-			"docstring" => $i_echoFloatArray_doc
-		),
-		"interopEchoTests.echoStruct" => array(
-			"function" => "i_echoStruct",
-			"signature" => $i_echoStruct_sig,
-			"docstring" => $i_echoStruct_doc
-		),
-		"interopEchoTests.echoStructArray" => array(
-			"function" => "i_echoStructArray",
-			"signature" => $i_echoStructArray_sig,
-			"docstring" => $i_echoStructArray_doc
-		),
-		"interopEchoTests.echoValue" => array(
-			"function" => "i_echoValue",
-			"signature" => $i_echoValue_sig,
-			"docstring" => $i_echoValue_doc
-		),
-		"interopEchoTests.echoBase64" => array(
-			"function" => "i_echoBase64",
-			"signature" => $i_echoBase64_sig,
-			"docstring" => $i_echoBase64_doc
-		),
-		"interopEchoTests.echoDate" => array(
-			"function" => "i_echoDate",
-			"signature" => $i_echoDate_sig,
-			"docstring" => $i_echoDate_doc
-		),
-		"interopEchoTests.whichToolkit" => array(
-			"function" => "i_whichToolkit",
-			"signature" => $i_whichToolkit_sig,
-			"docstring" => $i_whichToolkit_doc
-		)
-	);
-
-	if ($findstate2_sig)
-		$a['examples.php.getStateName'] = $findstate2_sig;
-
-	if ($findstate3_sig)
-		$a['examples.php2.getStateName'] = $findstate3_sig;
-
-	if ($findstate4_sig)
-		$a['examples.php3.getStateName'] = $findstate4_sig;
+    // WARNING; this functionality depends on the sendmail -t option
+    // it may not work with Windows machines properly; particularly
+    // the Bcc option. Sneak on your friends at your own risk!
+    function mail_send($m)
+    {
+        global $xmlrpcerruser, $xmlrpcBoolean;
+        $err="";
+
+        $mTo=$m->getParam(0);
+        $mSub=$m->getParam(1);
+        $mBody=$m->getParam(2);
+        $mFrom=$m->getParam(3);
+        $mCc=$m->getParam(4);
+        $mBcc=$m->getParam(5);
+        $mMime=$m->getParam(6);
+
+        if ($mTo->scalarval()=="")
+        {
+            $err="Error, no 'To' field specified";
+        }
+
+        if ($mFrom->scalarval()=="")
+        {
+            $err="Error, no 'From' field specified";
+        }
+
+        $msghdr="From: " . $mFrom->scalarval() . "\n";
+        $msghdr.="To: ". $mTo->scalarval() . "\n";
+
+        if ($mCc->scalarval()!="")
+        {
+            $msghdr.="Cc: " . $mCc->scalarval(). "\n";
+        }
+        if ($mBcc->scalarval()!="")
+        {
+            $msghdr.="Bcc: " . $mBcc->scalarval(). "\n";
+        }
+        if ($mMime->scalarval()!="")
+        {
+            $msghdr.="Content-type: " . $mMime->scalarval() . "\n";
+        }
+        $msghdr.="X-Mailer: XML-RPC for PHP mailer 1.0";
+
+        if ($err=="")
+        {
+            if (!mail("",
+                $mSub->scalarval(),
+                $mBody->scalarval(),
+                $msghdr))
+            {
+                $err="Error, could not send the mail.";
+            }
+        }
+
+        if ($err)
+        {
+            return new xmlrpcresp(0, $xmlrpcerruser, $err);
+        }
+        else
+        {
+            return new xmlrpcresp(new xmlrpcval("true", $xmlrpcBoolean));
+        }
+    }
+
+    $getallheaders_sig=array(array($xmlrpcStruct));
+    $getallheaders_doc='Returns a struct containing all the HTTP headers received with the request. Provides limited functionality with IIS';
+    function getallheaders_xmlrpc($m)
+    {
+        global $xmlrpcerruser;
+        if (function_exists('getallheaders'))
+        {
+            return new xmlrpcresp(php_xmlrpc_encode(getallheaders()));
+        }
+        else
+        {
+            $headers = array();
+            // IIS: poor man's version of getallheaders
+            foreach ($_SERVER as $key => $val)
+                if (strpos($key, 'HTTP_') === 0)
+                {
+                    $key = ucfirst(str_replace('_', '-', strtolower(substr($key, 5))));
+                    $headers[$key] = $val;
+                }
+            return new xmlrpcresp(php_xmlrpc_encode($headers));
+        }
+    }
+
+    $setcookies_sig=array(array($xmlrpcInt, $xmlrpcStruct));
+    $setcookies_doc='Sends to client a response containing a single \'1\' digit, and sets to it http cookies as received in the request (array of structs describing a cookie)';
+    function setcookies($m)
+    {
+        $m = $m->getParam(0);
+        while(list($name,$value) = $m->structeach())
+        {
+            $cookiedesc = php_xmlrpc_decode($value);
+            setcookie($name, @$cookiedesc['value'], @$cookiedesc['expires'], @$cookiedesc['path'], @$cookiedesc['domain'], @$cookiedesc['secure']);
+        }
+        return new xmlrpcresp(new xmlrpcval(1, 'int'));
+    }
+
+    $getcookies_sig=array(array($xmlrpcStruct));
+    $getcookies_doc='Sends to client a response containing all http cookies as received in the request (as struct)';
+    function getcookies($m)
+    {
+        return new xmlrpcresp(php_xmlrpc_encode($_COOKIE));
+    }
+
+    $v1_arrayOfStructs_sig=array(array($xmlrpcInt, $xmlrpcArray));
+    $v1_arrayOfStructs_doc='This handler takes a single parameter, an array of structs, each of which contains at least three elements named moe, larry and curly, all <i4>s. Your handler must add all the struct elements named curly and return the result.';
+    function v1_arrayOfStructs($m)
+    {
+        $sno=$m->getParam(0);
+        $numcurly=0;
+        for($i=0; $i<$sno->arraysize(); $i++)
+        {
+            $str=$sno->arraymem($i);
+            $str->structreset();
+            while(list($key,$val)=$str->structeach())
+            {
+                if ($key=="curly")
+                {
+                    $numcurly+=$val->scalarval();
+                }
+            }
+        }
+        return new xmlrpcresp(new xmlrpcval($numcurly, "int"));
+    }
+
+    $v1_easyStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct));
+    $v1_easyStruct_doc='This handler takes a single parameter, a struct, containing at least three elements named moe, larry and curly, all &lt;i4&gt;s. Your handler must add the three numbers and return the result.';
+    function v1_easyStruct($m)
+    {
+        $sno=$m->getParam(0);
+        $moe=$sno->structmem("moe");
+        $larry=$sno->structmem("larry");
+        $curly=$sno->structmem("curly");
+        $num=$moe->scalarval() + $larry->scalarval() + $curly->scalarval();
+        return new xmlrpcresp(new xmlrpcval($num, "int"));
+    }
+
+    $v1_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct));
+    $v1_echoStruct_doc='This handler takes a single parameter, a struct. Your handler must return the struct.';
+    function v1_echoStruct($m)
+    {
+        $sno=$m->getParam(0);
+        return new xmlrpcresp($sno);
+    }
+
+    $v1_manyTypes_sig=array(array(
+        $xmlrpcArray, $xmlrpcInt, $xmlrpcBoolean,
+        $xmlrpcString, $xmlrpcDouble, $xmlrpcDateTime,
+        $xmlrpcBase64
+    ));
+    $v1_manyTypes_doc='This handler takes six parameters, and returns an array containing all the parameters.';
+    function v1_manyTypes($m)
+    {
+        return new xmlrpcresp(new xmlrpcval(array(
+            $m->getParam(0),
+            $m->getParam(1),
+            $m->getParam(2),
+            $m->getParam(3),
+            $m->getParam(4),
+            $m->getParam(5)),
+            "array"
+        ));
+    }
+
+    $v1_moderateSizeArrayCheck_sig=array(array($xmlrpcString, $xmlrpcArray));
+    $v1_moderateSizeArrayCheck_doc='This handler takes a single parameter, which is an array containing between 100 and 200 elements. Each of the items is a string, your handler must return a string containing the concatenated text of the first and last elements.';
+    function v1_moderateSizeArrayCheck($m)
+    {
+        $ar=$m->getParam(0);
+        $sz=$ar->arraysize();
+        $first=$ar->arraymem(0);
+        $last=$ar->arraymem($sz-1);
+        return new xmlrpcresp(new xmlrpcval($first->scalarval() .
+        $last->scalarval(), "string"));
+    }
+
+    $v1_simpleStructReturn_sig=array(array($xmlrpcStruct, $xmlrpcInt));
+    $v1_simpleStructReturn_doc='This handler takes one parameter, and returns a struct containing three elements, times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.';
+    function v1_simpleStructReturn($m)
+    {
+        $sno=$m->getParam(0);
+        $v=$sno->scalarval();
+        return new xmlrpcresp(new xmlrpcval(array(
+            "times10"   => new xmlrpcval($v*10, "int"),
+            "times100"  => new xmlrpcval($v*100, "int"),
+            "times1000" => new xmlrpcval($v*1000, "int")),
+            "struct"
+        ));
+    }
+
+    $v1_nestedStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct));
+    $v1_nestedStruct_doc='This handler takes a single parameter, a struct, that models a daily calendar. At the top level, there is one struct for each year. Each year is broken down into months, and months into days. Most of the days are empty in the struct you receive, but the entry for April 1, 2000 contains a least three elements named moe, larry and curly, all &lt;i4&gt;s. Your handler must add the three numbers and return the result.';
+    function v1_nestedStruct($m)
+    {
+        $sno=$m->getParam(0);
+
+        $twoK=$sno->structmem("2000");
+        $april=$twoK->structmem("04");
+        $fools=$april->structmem("01");
+        $curly=$fools->structmem("curly");
+        $larry=$fools->structmem("larry");
+        $moe=$fools->structmem("moe");
+        return new xmlrpcresp(new xmlrpcval($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), "int"));
+    }
+
+    $v1_countTheEntities_sig=array(array($xmlrpcStruct, $xmlrpcString));
+    $v1_countTheEntities_doc='This handler takes a single parameter, a string, that contains any number of predefined entities, namely &lt;, &gt;, &amp; \' and ".<BR>Your handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets, ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.';
+    function v1_countTheEntities($m)
+    {
+        $sno=$m->getParam(0);
+        $str=$sno->scalarval();
+        $gt=0; $lt=0; $ap=0; $qu=0; $amp=0;
+        for($i=0; $i<strlen($str); $i++)
+        {
+            $c=substr($str, $i, 1);
+            switch($c)
+            {
+                case ">":
+                    $gt++;
+                    break;
+                case "<":
+                    $lt++;
+                    break;
+                case "\"":
+                    $qu++;
+                    break;
+                case "'":
+                    $ap++;
+                    break;
+                case "&":
+                    $amp++;
+                    break;
+                default:
+                    break;
+            }
+        }
+        return new xmlrpcresp(new xmlrpcval(array(
+            "ctLeftAngleBrackets"  => new xmlrpcval($lt, "int"),
+            "ctRightAngleBrackets" => new xmlrpcval($gt, "int"),
+            "ctAmpersands"         => new xmlrpcval($amp, "int"),
+            "ctApostrophes"        => new xmlrpcval($ap, "int"),
+            "ctQuotes"             => new xmlrpcval($qu, "int")),
+            "struct"
+        ));
+    }
+
+    // trivial interop tests
+    // http://www.xmlrpc.com/stories/storyReader$1636
+
+    $i_echoString_sig=array(array($xmlrpcString, $xmlrpcString));
+    $i_echoString_doc="Echoes string.";
+
+    $i_echoStringArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
+    $i_echoStringArray_doc="Echoes string array.";
+
+    $i_echoInteger_sig=array(array($xmlrpcInt, $xmlrpcInt));
+    $i_echoInteger_doc="Echoes integer.";
+
+    $i_echoIntegerArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
+    $i_echoIntegerArray_doc="Echoes integer array.";
+
+    $i_echoFloat_sig=array(array($xmlrpcDouble, $xmlrpcDouble));
+    $i_echoFloat_doc="Echoes float.";
+
+    $i_echoFloatArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
+    $i_echoFloatArray_doc="Echoes float array.";
+
+    $i_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct));
+    $i_echoStruct_doc="Echoes struct.";
+
+    $i_echoStructArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
+    $i_echoStructArray_doc="Echoes struct array.";
+
+    $i_echoValue_doc="Echoes any value back.";
+    $i_echoValue_sig=array(array($xmlrpcValue, $xmlrpcValue));
+
+    $i_echoBase64_sig=array(array($xmlrpcBase64, $xmlrpcBase64));
+    $i_echoBase64_doc="Echoes base64.";
+
+    $i_echoDate_sig=array(array($xmlrpcDateTime, $xmlrpcDateTime));
+    $i_echoDate_doc="Echoes dateTime.";
+
+    function i_echoParam($m)
+    {
+        $s=$m->getParam(0);
+        return new xmlrpcresp($s);
+    }
+
+    function i_echoString($m) { return i_echoParam($m); }
+    function i_echoInteger($m) { return i_echoParam($m); }
+    function i_echoFloat($m) { return i_echoParam($m); }
+    function i_echoStruct($m) { return i_echoParam($m); }
+    function i_echoStringArray($m) { return i_echoParam($m); }
+    function i_echoIntegerArray($m) { return i_echoParam($m); }
+    function i_echoFloatArray($m) { return i_echoParam($m); }
+    function i_echoStructArray($m) { return i_echoParam($m); }
+    function i_echoValue($m) { return i_echoParam($m); }
+    function i_echoBase64($m) { return i_echoParam($m); }
+    function i_echoDate($m) { return i_echoParam($m); }
+
+    $i_whichToolkit_sig=array(array($xmlrpcStruct));
+    $i_whichToolkit_doc="Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem.";
+
+    function i_whichToolkit($m)
+    {
+        global $xmlrpcName, $xmlrpcVersion,$SERVER_SOFTWARE;
+        $ret=array(
+            "toolkitDocsUrl" => "http://phpxmlrpc.sourceforge.net/",
+            "toolkitName" => $xmlrpcName,
+            "toolkitVersion" => $xmlrpcVersion,
+            "toolkitOperatingSystem" => isset ($SERVER_SOFTWARE) ? $SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE']
+        );
+        return new xmlrpcresp ( php_xmlrpc_encode($ret));
+    }
+
+    $o=new xmlrpc_server_methods_container;
+    $a=array(
+        "examples.getStateName" => array(
+            "function" => "findstate",
+            "signature" => $findstate_sig,
+            "docstring" => $findstate_doc
+        ),
+        "examples.sortByAge" => array(
+            "function" => "agesorter",
+            "signature" => $agesorter_sig,
+            "docstring" => $agesorter_doc
+        ),
+        "examples.addtwo" => array(
+            "function" => "addtwo",
+            "signature" => $addtwo_sig,
+            "docstring" => $addtwo_doc
+        ),
+        "examples.addtwodouble" => array(
+            "function" => "addtwodouble",
+            "signature" => $addtwodouble_sig,
+            "docstring" => $addtwodouble_doc
+        ),
+        "examples.stringecho" => array(
+            "function" => "stringecho",
+            "signature" => $stringecho_sig,
+            "docstring" => $stringecho_doc
+        ),
+        "examples.echo" => array(
+            "function" => "echoback",
+            "signature" => $echoback_sig,
+            "docstring" => $echoback_doc
+        ),
+        "examples.decode64" => array(
+            "function" => "echosixtyfour",
+            "signature" => $echosixtyfour_sig,
+            "docstring" => $echosixtyfour_doc
+        ),
+        "examples.invertBooleans" => array(
+            "function" => "bitflipper",
+            "signature" => $bitflipper_sig,
+            "docstring" => $bitflipper_doc
+        ),
+        "examples.generatePHPWarning" => array(
+            "function" => array($o, "phpwarninggenerator")
+            //'function' => 'xmlrpc_server_methods_container::phpwarninggenerator'
+        ),
+        "examples.raiseException" => array(
+            "function" => array($o, "exceptiongenerator")
+        ),
+        "examples.getallheaders" => array(
+            "function" => 'getallheaders_xmlrpc',
+            "signature" => $getallheaders_sig,
+            "docstring" => $getallheaders_doc
+        ),
+        "examples.setcookies" => array(
+            "function" => 'setcookies',
+            "signature" => $setcookies_sig,
+            "docstring" => $setcookies_doc
+        ),
+        "examples.getcookies" => array(
+            "function" => 'getcookies',
+            "signature" => $getcookies_sig,
+            "docstring" => $getcookies_doc
+        ),
+        "mail.send" => array(
+            "function" => "mail_send",
+            "signature" => $mail_send_sig,
+            "docstring" => $mail_send_doc
+        ),
+        "validator1.arrayOfStructsTest" => array(
+            "function" => "v1_arrayOfStructs",
+            "signature" => $v1_arrayOfStructs_sig,
+            "docstring" => $v1_arrayOfStructs_doc
+        ),
+        "validator1.easyStructTest" => array(
+            "function" => "v1_easyStruct",
+            "signature" => $v1_easyStruct_sig,
+            "docstring" => $v1_easyStruct_doc
+        ),
+        "validator1.echoStructTest" => array(
+            "function" => "v1_echoStruct",
+            "signature" => $v1_echoStruct_sig,
+            "docstring" => $v1_echoStruct_doc
+        ),
+        "validator1.manyTypesTest" => array(
+            "function" => "v1_manyTypes",
+            "signature" => $v1_manyTypes_sig,
+            "docstring" => $v1_manyTypes_doc
+        ),
+        "validator1.moderateSizeArrayCheck" => array(
+            "function" => "v1_moderateSizeArrayCheck",
+            "signature" => $v1_moderateSizeArrayCheck_sig,
+            "docstring" => $v1_moderateSizeArrayCheck_doc
+        ),
+        "validator1.simpleStructReturnTest" => array(
+            "function" => "v1_simpleStructReturn",
+            "signature" => $v1_simpleStructReturn_sig,
+            "docstring" => $v1_simpleStructReturn_doc
+        ),
+        "validator1.nestedStructTest" => array(
+            "function" => "v1_nestedStruct",
+            "signature" => $v1_nestedStruct_sig,
+            "docstring" => $v1_nestedStruct_doc
+        ),
+        "validator1.countTheEntities" => array(
+            "function" => "v1_countTheEntities",
+            "signature" => $v1_countTheEntities_sig,
+            "docstring" => $v1_countTheEntities_doc
+        ),
+        "interopEchoTests.echoString" => array(
+            "function" => "i_echoString",
+            "signature" => $i_echoString_sig,
+            "docstring" => $i_echoString_doc
+        ),
+        "interopEchoTests.echoStringArray" => array(
+            "function" => "i_echoStringArray",
+            "signature" => $i_echoStringArray_sig,
+            "docstring" => $i_echoStringArray_doc
+        ),
+        "interopEchoTests.echoInteger" => array(
+            "function" => "i_echoInteger",
+            "signature" => $i_echoInteger_sig,
+            "docstring" => $i_echoInteger_doc
+        ),
+        "interopEchoTests.echoIntegerArray" => array(
+            "function" => "i_echoIntegerArray",
+            "signature" => $i_echoIntegerArray_sig,
+            "docstring" => $i_echoIntegerArray_doc
+        ),
+        "interopEchoTests.echoFloat" => array(
+            "function" => "i_echoFloat",
+            "signature" => $i_echoFloat_sig,
+            "docstring" => $i_echoFloat_doc
+        ),
+        "interopEchoTests.echoFloatArray" => array(
+            "function" => "i_echoFloatArray",
+            "signature" => $i_echoFloatArray_sig,
+            "docstring" => $i_echoFloatArray_doc
+        ),
+        "interopEchoTests.echoStruct" => array(
+            "function" => "i_echoStruct",
+            "signature" => $i_echoStruct_sig,
+            "docstring" => $i_echoStruct_doc
+        ),
+        "interopEchoTests.echoStructArray" => array(
+            "function" => "i_echoStructArray",
+            "signature" => $i_echoStructArray_sig,
+            "docstring" => $i_echoStructArray_doc
+        ),
+        "interopEchoTests.echoValue" => array(
+            "function" => "i_echoValue",
+            "signature" => $i_echoValue_sig,
+            "docstring" => $i_echoValue_doc
+        ),
+        "interopEchoTests.echoBase64" => array(
+            "function" => "i_echoBase64",
+            "signature" => $i_echoBase64_sig,
+            "docstring" => $i_echoBase64_doc
+        ),
+        "interopEchoTests.echoDate" => array(
+            "function" => "i_echoDate",
+            "signature" => $i_echoDate_sig,
+            "docstring" => $i_echoDate_doc
+        ),
+        "interopEchoTests.whichToolkit" => array(
+            "function" => "i_whichToolkit",
+            "signature" => $i_whichToolkit_sig,
+            "docstring" => $i_whichToolkit_doc
+        )
+    );
+
+    if ($findstate2_sig)
+        $a['examples.php.getStateName'] = $findstate2_sig;
+
+    if ($findstate3_sig)
+        $a['examples.php2.getStateName'] = $findstate3_sig;
+
+    if ($findstate4_sig)
+        $a['examples.php3.getStateName'] = $findstate4_sig;
 
     if ($findstate5_sig)
         $a['examples.php4.getStateName'] = $findstate5_sig;
 
-	$s=new xmlrpc_server($a, false);
-	$s->setdebug(3);
-	$s->compress_response = true;
-
-	// out-of-band information: let the client manipulate the server operations.
-	// we do this to help the testsuite script: do not reproduce in production!
-	if (isset($_GET['RESPONSE_ENCODING']))
-		$s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
-	if (isset($_GET['EXCEPTION_HANDLING']))
-		$s->exception_handling = $_GET['EXCEPTION_HANDLING'];
-	$s->service();
-	// that should do all we need!
-?>
\ No newline at end of file
+    $s=new xmlrpc_server($a, false);
+    $s->setdebug(3);
+    $s->compress_response = true;
+
+    // out-of-band information: let the client manipulate the server operations.
+    // we do this to help the testsuite script: do not reproduce in production!
+    if (isset($_GET['RESPONSE_ENCODING']))
+        $s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
+    if (isset($_GET['EXCEPTION_HANDLING']))
+        $s->exception_handling = $_GET['EXCEPTION_HANDLING'];
+    $s->service();
+    // that should do all we need!
diff --git a/demo/vardemo.php b/demo/vardemo.php
index 3e7a4018..05846b45 100644
--- a/demo/vardemo.php
+++ b/demo/vardemo.php
@@ -2,59 +2,59 @@
 <head><title>xmlrpc</title></head>
 <body>
 <?php
-	include("xmlrpc.inc");
-
-	$f = new xmlrpcmsg('examples.getStateName');
-
-	print "<h3>Testing value serialization</h3>\n";
-
-	$v = new xmlrpcval(23, "int");
-	print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
-	$v = new xmlrpcval("What are you saying? >> << &&");
-	print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
-
-	$v = new xmlrpcval(array(
-		new xmlrpcval("ABCDEFHIJ"),
-		new xmlrpcval(1234, 'int'),
-		new xmlrpcval(1, 'boolean')),
-		"array"
-	);
-
-	print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
-
-	$v = new xmlrpcval(
-		array(
-			"thearray" => new xmlrpcval(
-				array(
-					new xmlrpcval("ABCDEFHIJ"),
-					new xmlrpcval(1234, 'int'),
-					new xmlrpcval(1, 'boolean'),
-					new xmlrpcval(0, 'boolean'),
-					new xmlrpcval(true, 'boolean'),
-					new xmlrpcval(false, 'boolean')
-				),
-				"array"
-			),
-			"theint" => new xmlrpcval(23, 'int'),
-			"thestring" => new xmlrpcval("foobarwhizz"),
-			"thestruct" => new xmlrpcval(
-				array(
-					"one" => new xmlrpcval(1, 'int'),
-					"two" => new xmlrpcval(2, 'int')
-				),
-				"struct"
-			)
-		),
-		"struct"
-	);
-
-	print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
-
-	$w = new xmlrpcval(array($v, new xmlrpcval("That was the struct!")), "array");
-
-	print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
-
-	$w = new xmlrpcval("Mary had a little lamb,
+    include("xmlrpc.inc");
+
+    $f = new xmlrpcmsg('examples.getStateName');
+
+    print "<h3>Testing value serialization</h3>\n";
+
+    $v = new xmlrpcval(23, "int");
+    print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
+    $v = new xmlrpcval("What are you saying? >> << &&");
+    print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
+
+    $v = new xmlrpcval(array(
+        new xmlrpcval("ABCDEFHIJ"),
+        new xmlrpcval(1234, 'int'),
+        new xmlrpcval(1, 'boolean')),
+        "array"
+    );
+
+    print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
+
+    $v = new xmlrpcval(
+        array(
+            "thearray" => new xmlrpcval(
+                array(
+                    new xmlrpcval("ABCDEFHIJ"),
+                    new xmlrpcval(1234, 'int'),
+                    new xmlrpcval(1, 'boolean'),
+                    new xmlrpcval(0, 'boolean'),
+                    new xmlrpcval(true, 'boolean'),
+                    new xmlrpcval(false, 'boolean')
+                ),
+                "array"
+            ),
+            "theint" => new xmlrpcval(23, 'int'),
+            "thestring" => new xmlrpcval("foobarwhizz"),
+            "thestruct" => new xmlrpcval(
+                array(
+                    "one" => new xmlrpcval(1, 'int'),
+                    "two" => new xmlrpcval(2, 'int')
+                ),
+                "struct"
+            )
+        ),
+        "struct"
+    );
+
+    print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
+
+    $w = new xmlrpcval(array($v, new xmlrpcval("That was the struct!")), "array");
+
+    print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
+
+    $w = new xmlrpcval("Mary had a little lamb,
 Whose fleece was white as snow,
 And everywhere that Mary went
 the lamb was sure to go.
@@ -63,29 +63,29 @@ Mary had a little lamb
 She tied it to a pylon
 Ten thousand volts went down its back
 And turned it into nylon", "base64"
-	);
-	print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
-	print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>";
+    );
+    print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
+    print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>";
 
-	$f->method('');
-	$f->addParam(new xmlrpcval("41", "int"));
+    $f->method('');
+    $f->addParam(new xmlrpcval("41", "int"));
 
-	print "<h3>Testing request serialization</h3>\n";
-	$op = $f->serialize();
-	print "<PRE>" . htmlentities($op) . "</PRE>";
+    print "<h3>Testing request serialization</h3>\n";
+    $op = $f->serialize();
+    print "<PRE>" . htmlentities($op) . "</PRE>";
 
-	print "<h3>Testing ISO date format</h3><pre>\n";
+    print "<h3>Testing ISO date format</h3><pre>\n";
 
-	$t = time();
-	$date = iso8601_encode($t);
-	print "Now is $t --> $date\n";
-	print "Or in UTC, that is " . iso8601_encode($t, 1) . "\n";
-	$tb = iso8601_decode($date);
-	print "That is to say $date --> $tb\n";
-	print "Which comes out at " . iso8601_encode($tb) . "\n";
-	print "Which was the time in UTC at " . iso8601_decode($date, 1) . "\n";
+    $t = time();
+    $date = iso8601_encode($t);
+    print "Now is $t --> $date\n";
+    print "Or in UTC, that is " . iso8601_encode($t, 1) . "\n";
+    $tb = iso8601_decode($date);
+    print "That is to say $date --> $tb\n";
+    print "Which comes out at " . iso8601_encode($tb) . "\n";
+    print "Which was the time in UTC at " . iso8601_decode($date, 1) . "\n";
 
-	print "</pre>\n";
+    print "</pre>\n";
 ?>
 </body>
 </html>
diff --git a/doc/convert.php b/doc/convert.php
index 8e7f7f0c..4de3b444 100644
--- a/doc/convert.php
+++ b/doc/convert.php
@@ -55,4 +55,3 @@ if (!is_dir($_SERVER['argv'][3]))
     file_put_contents($_SERVER['argv'][3], $out);
 
 echo "OK\n";
-?>
\ No newline at end of file
diff --git a/doc/highlight.php b/doc/highlight.php
index eb8eacb9..b8afda17 100644
--- a/doc/highlight.php
+++ b/doc/highlight.php
@@ -17,12 +17,12 @@ function highlight($file)
   while(($start = strpos($content, $starttag, $last)) !== false)
   {
     $end = strpos($content, $endtag, $start);
-	$code = substr($content, $start+strlen($starttag), $end-$start-strlen($starttag));
-	if ($code[strlen($code)-1] == "\n") {
-		$code = substr($code, 0, -1);
-	}
+    $code = substr($content, $start+strlen($starttag), $end-$start-strlen($starttag));
+    if ($code[strlen($code)-1] == "\n") {
+        $code = substr($code, 0, -1);
+    }
 //var_dump($code);
-	$code = str_replace(array('&gt;', '&lt;'), array('>', '<'), $code);
+    $code = str_replace(array('&gt;', '&lt;'), array('>', '<'), $code);
     $code = highlight_string('<?php '.$code, true);
     $code = str_replace('<span style="color: #0000BB">&lt;?php&nbsp;<br />', '<span style="color: #0000BB">', $code);
 //echo($code);
@@ -38,11 +38,9 @@ $dir = $argv[1];
 $files = scandir($dir);
 foreach($files as $file)
 {
-	if (substr($file, -5, 5) == '.html')
-	{
-		$out = highlight($dir.'/'.$file);
-		file_put_contents($dir.'/'.$file, $out);
-	}
+    if (substr($file, -5, 5) == '.html')
+    {
+        $out = highlight($dir.'/'.$file);
+        file_put_contents($dir.'/'.$file, $out);
+    }
 }
-
-?>
\ No newline at end of file
diff --git a/doc/xmlrpc_php.xml b/doc/xmlrpc_php.xml
index 9262814f..91b1c46c 100644
--- a/doc/xmlrpc_php.xml
+++ b/doc/xmlrpc_php.xml
@@ -8,10 +8,10 @@ PHP-XMLRPC User manual
 <book lang="en">
   <title>XML-RPC for PHP</title>
 
-  <subtitle>version 3.0.0 beta</subtitle>
+  <subtitle>version 3.0.0</subtitle>
 
   <bookinfo>
-    <date>Sep 5, 2009</date>
+    <date>Feb 2, 2014</date>
 
     <authorgroup>
       <author>
@@ -212,6 +212,15 @@ PHP-XMLRPC User manual
     functions and methods please take a look at the source code of the
     library, which is quite thoroughly commented in javadoc-like form.</para>
 
+    <sect1>
+      <title>3.0.0</title>
+      <para><itemizedlist>
+        <listitem>
+            <para>...</para>
+        </listitem>
+      </itemizedlist></para>
+    </sect1>
+
     <sect1>
       <title>3.0.0 beta</title>
 
@@ -806,9 +815,6 @@ PHP-XMLRPC User manual
           <code>wrap_php_function</code> and <code>wrap_xmlrpc_method</code>,
           and has many caveats, with php being a typeless language and
           all...</para>
-
-          <para>With PHP versions lesser than 5.0.3 wrapping of php functions
-          into xmlrpc methods is not supported yet.</para>
         </listitem>
 
         <listitem>
@@ -855,11 +861,7 @@ PHP-XMLRPC User manual
     configuration.</para>
 
     <para>The <emphasis>minimum supported</emphasis> PHP version is
-    5.0.</para>
-
-    <para>Automatic generation of xml-rpc methods from php functions is only
-    supported with PHP version 5.0.3 and later (note that the lib will
-    generate some warnings with PHP 5 in strict error reporting mode).</para>
+    5.1.0</para>
 
     <para>If you wish to use SSL or HTTP 1.1 to communicate with remote
     servers, you need the "curl" extension compiled into your PHP
@@ -3642,7 +3644,7 @@ else {
         transparently carried out by the lib, while datetime vals are passed
         around as strings).</para>
 
-        <para>Known limitations: requires PHP 5.0.3 +; only works for
+        <para>Known limitations: only works for
         user-defined functions, not for PHP internal functions (reflection
         does not support retrieving number/type of params for those); the
         wrapped php function will not be able to programmatically return an
diff --git a/lib/phpxmlrpc.php b/lib/phpxmlrpc.php
index 5edc2eec..8c3d34cb 100644
--- a/lib/phpxmlrpc.php
+++ b/lib/phpxmlrpc.php
@@ -193,5 +193,3 @@ class Phpxmlrpc {
         return Phpxmlrpc::$instance;
     }
 }
-
-?>
\ No newline at end of file
diff --git a/lib/xmlrpc.php b/lib/xmlrpc.php
index efc56228..111e6b24 100644
--- a/lib/xmlrpc.php
+++ b/lib/xmlrpc.php
@@ -579,7 +579,7 @@ function xmlrpc_cd($parser, $data)
             // we always initialize the accumulator before starting parsing, anyway...
             //if(!@isset($xmlrpc->_xh['ac']))
             //{
-            //	$xmlrpc->_xh['ac'] = '';
+            //    $xmlrpc->_xh['ac'] = '';
             //}
             $xmlrpc->_xh['ac'].=$data;
         }
@@ -599,7 +599,7 @@ function xmlrpc_dh($parser, $data)
             // G. Giunta 2006-08-25: useless change of 'lv' from 1 to 2
             //if($xmlrpc->_xh['lv']==1)
             //{
-            //	$xmlrpc->_xh['lv']=2;
+            //    $xmlrpc->_xh['lv']=2;
             //}
             $xmlrpc->_xh['ac'].=$data;
         }
@@ -808,7 +808,7 @@ else
  * @author Dan Libby (dan@libby.com)
  *
  * @param mixed $php_val the value to be converted into an xmlrpcval object
- * @param array $options	can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'
+ * @param array $options can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'
  * @return xmlrpcval
  */
 function php_xmlrpc_encode($php_val, $options=array())
@@ -1187,5 +1187,3 @@ function is_valid_charset($encoding, $validlist)
         return false;
     }
 }
-
-?>
\ No newline at end of file
diff --git a/lib/xmlrpc_client.php b/lib/xmlrpc_client.php
index 7e58aeee..0a75f4c9 100644
--- a/lib/xmlrpc_client.php
+++ b/lib/xmlrpc_client.php
@@ -1,4 +1,5 @@
 <?php
+
 class xmlrpc_client
 {
     /// @todo: does these need to be public?
@@ -1123,5 +1124,4 @@ class xmlrpc_client
             return $response;
         }
     }
-} // end class xmlrpc_client
-?>
\ No newline at end of file
+}
diff --git a/lib/xmlrpc_wrappers.php b/lib/xmlrpc_wrappers.php
index 01dfbcaa..e96be5e5 100644
--- a/lib/xmlrpc_wrappers.php
+++ b/lib/xmlrpc_wrappers.php
@@ -443,7 +443,7 @@ function wrap_php_function($funcname, $newfuncname='', $extra_options=array())
         }
         // shall we exclude functions returning by ref?
         // if($func->returnsReference())
-        // 	return false;
+        //     return false;
         $code = "function $xmlrpcfuncname(\$msg) {\n" . $innercode . "}\n}";
         //print_r($code);
         if ($buildit)
@@ -930,4 +930,3 @@ function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlr
     //$code .= "\$client->setDebug(\$debug);\n";
     return $code;
 }
-?>
\ No newline at end of file
diff --git a/lib/xmlrpcmsg.php b/lib/xmlrpcmsg.php
index 05e627d7..569a5490 100644
--- a/lib/xmlrpcmsg.php
+++ b/lib/xmlrpcmsg.php
@@ -609,4 +609,3 @@ class xmlrpcmsg {
         return $r;
     }
 }
-?>
\ No newline at end of file
diff --git a/lib/xmlrpcresp.php b/lib/xmlrpcresp.php
index 98981739..527b4639 100644
--- a/lib/xmlrpcresp.php
+++ b/lib/xmlrpcresp.php
@@ -161,5 +161,3 @@ xmlrpc_encode_entitites($this->errstr, $xmlrpc->xmlrpc_internalencoding, $charse
         return $result;
     }
 }
-
-?>
\ No newline at end of file
diff --git a/lib/xmlrpcs.php b/lib/xmlrpcs.php
index 27efd630..3236a85c 100644
--- a/lib/xmlrpcs.php
+++ b/lib/xmlrpcs.php
@@ -259,7 +259,7 @@ function _xmlrpcs_multicall_do_call($server, $call)
 
     if($result->faultCode() != 0)
     {
-        return _xmlrpcs_multicall_error($result);		// Method returned fault.
+        return _xmlrpcs_multicall_error($result); // Method returned fault.
     }
 
     return new xmlrpcval(array($result->value()), 'array');
@@ -303,7 +303,7 @@ function _xmlrpcs_multicall_do_call_phpvals($server, $call)
 
     if($result->faultCode() != 0)
     {
-        return _xmlrpcs_multicall_error($result);		// Method returned fault.
+        return _xmlrpcs_multicall_error($result); // Method returned fault.
     }
 
     return new xmlrpcval(array($result->value()), 'array');
@@ -695,7 +695,7 @@ class xmlrpc_server
     function add_to_map($methodname,$function,$sig=null,$doc=false,$sigdoc=false)
     {
         $this->dmap[$methodname] = array(
-            'function'	=> $function,
+            'function' => $function,
             'docstring' => $doc
         );
         if ($sig)
@@ -910,7 +910,7 @@ class xmlrpc_server
         // 2005/05/07 commented and moved into caller function code
         //if($data=='')
         //{
-        //	$data=$GLOBALS['HTTP_RAW_POST_DATA'];
+        //    $data=$GLOBALS['HTTP_RAW_POST_DATA'];
         //}
 
         // G. Giunta 2005/02/13: we do NOT expect to receive html entities
@@ -1236,4 +1236,3 @@ class xmlrpc_server
         print $r->serialize();
     }
 }
-?>
\ No newline at end of file
diff --git a/lib/xmlrpcval.php b/lib/xmlrpcval.php
index 59ef28b7..56c7af3e 100644
--- a/lib/xmlrpcval.php
+++ b/lib/xmlrpcval.php
@@ -477,5 +477,3 @@ class xmlrpcval {
         return count($this->me['struct']);
     }
 }
-
-?>
\ No newline at end of file
diff --git a/test/benchmark.php b/test/benchmark.php
index 700e487c..4e408381 100644
--- a/test/benchmark.php
+++ b/test/benchmark.php
@@ -8,225 +8,225 @@
  * @todo add a test for response ok in call testing?
  **/
 
-	include(getcwd().'/parse_args.php');
-
-	require_once('xmlrpc.inc');
-
-	// Set up PHP structures to be used in many tests
-	$data1 = array(1, 1.0, 'hello world', true, '20051021T23:43:00', -1, 11.0, '~!@#$%^&*()_+|', false, '20051021T23:43:00');
-	$data2 = array('zero' => $data1, 'one' => $data1, 'two' => $data1, 'three' => $data1, 'four' => $data1, 'five' => $data1, 'six' => $data1, 'seven' => $data1, 'eight' => $data1, 'nine' => $data1);
-	$data = array($data2, $data2, $data2, $data2, $data2, $data2, $data2, $data2, $data2, $data2);
-	$keys = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
-
-	$test_results=array();
-	$xd = extension_loaded('xdebug') && ini_get('xdebug.profiler_enable');
-	if ($xd)
-		$num_tests = 1;
-	else
-		$num_tests = 10;
-
-	$title = 'XML-RPC Benchmark Tests';
-
-	if(isset($_SERVER['REQUEST_METHOD']))
-	{
-		echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n<head>\n<title>$title</title>\n</head>\n<body>\n<h1>$title</h1>\n<pre>\n";
-	}
-	else
-	{
-		echo "$title\n\n";
-	}
-
-	if(isset($_SERVER['REQUEST_METHOD']))
-	{
-		echo "<h3>Using lib version: $xmlrpcVersion on PHP version: ".phpversion()."</h3>\n";
-		if ($xd) echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: ".htmlspecialchars(xdebug_get_profiler_filename())."</h4>\n";
-		flush();
-		ob_flush();
-	}
-	else
-	{
-		echo "Using lib version: $xmlrpcVersion on PHP version: ".phpversion()."\n";
-		if ($xd) echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: ".xdebug_get_profiler_filename()."\n";
-	}
-
-	// test 'old style' data encoding vs. 'automatic style' encoding
-	begin_test('Data encoding (large array)', 'manual encoding');
-	for ($i = 0; $i < $num_tests; $i++)
-	{
-		$vals = array();
-		for ($j = 0; $j < 10; $j++)
-		{
-			$valarray = array();
-			foreach ($data[$j] as $key => $val)
-			{
-				$values = array();
-				$values[] = new xmlrpcval($val[0], 'int');
-				$values[] = new xmlrpcval($val[1], 'double');
-				$values[] = new xmlrpcval($val[2], 'string');
-				$values[] = new xmlrpcval($val[3], 'boolean');
-				$values[] = new xmlrpcval($val[4], 'dateTime.iso8601');
-				$values[] = new xmlrpcval($val[5], 'int');
-				$values[] = new xmlrpcval($val[6], 'double');
-				$values[] = new xmlrpcval($val[7], 'string');
-				$values[] = new xmlrpcval($val[8], 'boolean');
-				$values[] = new xmlrpcval($val[9], 'dateTime.iso8601');
-				$valarray[$key] = new xmlrpcval($values, 'array');
-			}
-			$vals[] = new xmlrpcval($valarray, 'struct');
-		}
-		$value = new xmlrpcval($vals, 'array');
-		$out = $value->serialize();
-	}
-	end_test('Data encoding (large array)', 'manual encoding', $out);
-
-	begin_test('Data encoding (large array)', 'automatic encoding');
-	for ($i = 0; $i < $num_tests; $i++)
-	{
-		$value = php_xmlrpc_encode($data, array('auto_dates'));
-		$out = $value->serialize();
-	}
-	end_test('Data encoding (large array)', 'automatic encoding', $out);
-
-	if (function_exists('xmlrpc_set_type'))
-	{
-	begin_test('Data encoding (large array)', 'xmlrpc-epi encoding');
-	for ($i = 0; $i < $num_tests; $i++)
-	{
-		for ($j = 0; $j < 10; $j++)
-			foreach ($keys as $k)
-			{
-				xmlrpc_set_type($data[$j][$k][4], 'datetime');
-				xmlrpc_set_type($data[$j][$k][8], 'datetime');
-			}
-		$out = xmlrpc_encode($data);
-	}
-	end_test('Data encoding (large array)', 'xmlrpc-epi encoding', $out);
-	}
-
-	// test 'old style' data decoding vs. 'automatic style' decoding
-	$dummy = new xmlrpcmsg('');
-	$out = new xmlrpcresp($value);
-	$in = '<?xml version="1.0" ?>'."\n".$out->serialize();
-
-	begin_test('Data decoding (large array)', 'manual decoding');
-	for ($i = 0; $i < $num_tests; $i++)
-	{
-		$response =& $dummy->ParseResponse($in, true);
-		$value = $response->value();
-		$result = array();
-		for ($k = 0; $k < $value->arraysize(); $k++)
-		{
-			$val1 = $value->arraymem($k);
-			$out = array();
-			while (list($name, $val) = $val1->structeach())
-			{
-				$out[$name] = array();
-				for ($j = 0; $j < $val->arraysize(); $j++)
-				{
-					$data = $val->arraymem($j);
-					$out[$name][] = $data->scalarval();
-				}
-			} // while
-			$result[] = $out;
-		}
-	}
-	end_test('Data decoding (large array)', 'manual decoding', $result);
-
-	begin_test('Data decoding (large array)', 'automatic decoding');
-	for ($i = 0; $i < $num_tests; $i++)
-	{
-		$response =& $dummy->ParseResponse($in, true, 'phpvals');
-		$value = $response->value();
-	}
-	end_test('Data decoding (large array)', 'automatic decoding', $value);
-
-	if (function_exists('xmlrpc_decode'))
-	{
-	begin_test('Data decoding (large array)', 'xmlrpc-epi decoding');
-	for ($i = 0; $i < $num_tests; $i++)
-	{
-		$response =& $dummy->ParseResponse($in, true, 'xml');
-		$value = xmlrpc_decode($response->value());
-	}
-	end_test('Data decoding (large array)', 'xmlrpc-epi decoding', $value);
-	}
-
-	if (!$xd) {
-
-	/// test multicall vs. many calls vs. keep-alives
-	$value = php_xmlrpc_encode($data1, array('auto_dates'));
-	$msg = new xmlrpcmsg('interopEchoTests.echoValue', array($value));
-	$msgs=array();
-	for ($i = 0; $i < 25; $i++)
-		$msgs[] = $msg;
-	$server = explode(':', $LOCALSERVER);
-	if(count($server) > 1)
-	{
-		$c = new xmlrpc_client($URI, $server[0], $server[1]);
-	}
-	else
-	{
-		$c = new xmlrpc_client($URI, $LOCALSERVER);
-	}
-	// do not interfere with http compression
-	$c->accepted_compression = array();
-	//$c->debug=true;
-
-	if (function_exists('gzinflate')) {
-		$c->accepted_compression = null;
-	}
-	begin_test('Repeated send (small array)', 'http 10');
-	$response = array();
-	for ($i = 0; $i < 25; $i++)
-	{
-		$resp =& $c->send($msg);
-		$response[] = $resp->value();
-	}
-	end_test('Repeated send (small array)', 'http 10', $response);
-
-	if (function_exists('curl_init'))
-	{
-		begin_test('Repeated send (small array)', 'http 11 w. keep-alive');
-		$response = array();
-		for ($i = 0; $i < 25; $i++)
-		{
-			$resp =& $c->send($msg, 10, 'http11');
-			$response[] = $resp->value();
-		}
-		end_test('Repeated send (small array)', 'http 11 w. keep-alive', $response);
-
-		$c->keepalive = false;
-		begin_test('Repeated send (small array)', 'http 11');
-		$response = array();
-		for ($i = 0; $i < 25; $i++)
-		{
-			$resp =& $c->send($msg, 10, 'http11');
-			$response[] = $resp->value();
-		}
-		end_test('Repeated send (small array)', 'http 11', $response);
-	}
-
-	begin_test('Repeated send (small array)', 'multicall');
-	$response =& $c->send($msgs);
-	foreach ($response as $key =>& $val)
-	{
-	    $val = $val->value();
-	}
-	end_test('Repeated send (small array)', 'multicall', $response);
-
-	if (function_exists('gzinflate'))
-	{
-		$c->accepted_compression = array('gzip');
-		$c->request_compression = 'gzip';
-
-		begin_test('Repeated send (small array)', 'http 10 w. compression');
-		$response = array();
-		for ($i = 0; $i < 25; $i++)
-		{
-			$resp =& $c->send($msg);
-			$response[] = $resp->value();
-		}
-		end_test('Repeated send (small array)', 'http 10 w. compression', $response);
+    include(getcwd().'/parse_args.php');
+
+    require_once('xmlrpc.inc');
+
+    // Set up PHP structures to be used in many tests
+    $data1 = array(1, 1.0, 'hello world', true, '20051021T23:43:00', -1, 11.0, '~!@#$%^&*()_+|', false, '20051021T23:43:00');
+    $data2 = array('zero' => $data1, 'one' => $data1, 'two' => $data1, 'three' => $data1, 'four' => $data1, 'five' => $data1, 'six' => $data1, 'seven' => $data1, 'eight' => $data1, 'nine' => $data1);
+    $data = array($data2, $data2, $data2, $data2, $data2, $data2, $data2, $data2, $data2, $data2);
+    $keys = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
+
+    $test_results=array();
+    $xd = extension_loaded('xdebug') && ini_get('xdebug.profiler_enable');
+    if ($xd)
+        $num_tests = 1;
+    else
+        $num_tests = 10;
+
+    $title = 'XML-RPC Benchmark Tests';
+
+    if(isset($_SERVER['REQUEST_METHOD']))
+    {
+        echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n<head>\n<title>$title</title>\n</head>\n<body>\n<h1>$title</h1>\n<pre>\n";
+    }
+    else
+    {
+        echo "$title\n\n";
+    }
+
+    if(isset($_SERVER['REQUEST_METHOD']))
+    {
+        echo "<h3>Using lib version: $xmlrpcVersion on PHP version: ".phpversion()."</h3>\n";
+        if ($xd) echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: ".htmlspecialchars(xdebug_get_profiler_filename())."</h4>\n";
+        flush();
+        ob_flush();
+    }
+    else
+    {
+        echo "Using lib version: $xmlrpcVersion on PHP version: ".phpversion()."\n";
+        if ($xd) echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: ".xdebug_get_profiler_filename()."\n";
+    }
+
+    // test 'old style' data encoding vs. 'automatic style' encoding
+    begin_test('Data encoding (large array)', 'manual encoding');
+    for ($i = 0; $i < $num_tests; $i++)
+    {
+        $vals = array();
+        for ($j = 0; $j < 10; $j++)
+        {
+            $valarray = array();
+            foreach ($data[$j] as $key => $val)
+            {
+                $values = array();
+                $values[] = new xmlrpcval($val[0], 'int');
+                $values[] = new xmlrpcval($val[1], 'double');
+                $values[] = new xmlrpcval($val[2], 'string');
+                $values[] = new xmlrpcval($val[3], 'boolean');
+                $values[] = new xmlrpcval($val[4], 'dateTime.iso8601');
+                $values[] = new xmlrpcval($val[5], 'int');
+                $values[] = new xmlrpcval($val[6], 'double');
+                $values[] = new xmlrpcval($val[7], 'string');
+                $values[] = new xmlrpcval($val[8], 'boolean');
+                $values[] = new xmlrpcval($val[9], 'dateTime.iso8601');
+                $valarray[$key] = new xmlrpcval($values, 'array');
+            }
+            $vals[] = new xmlrpcval($valarray, 'struct');
+        }
+        $value = new xmlrpcval($vals, 'array');
+        $out = $value->serialize();
+    }
+    end_test('Data encoding (large array)', 'manual encoding', $out);
+
+    begin_test('Data encoding (large array)', 'automatic encoding');
+    for ($i = 0; $i < $num_tests; $i++)
+    {
+        $value = php_xmlrpc_encode($data, array('auto_dates'));
+        $out = $value->serialize();
+    }
+    end_test('Data encoding (large array)', 'automatic encoding', $out);
+
+    if (function_exists('xmlrpc_set_type'))
+    {
+    begin_test('Data encoding (large array)', 'xmlrpc-epi encoding');
+    for ($i = 0; $i < $num_tests; $i++)
+    {
+        for ($j = 0; $j < 10; $j++)
+            foreach ($keys as $k)
+            {
+                xmlrpc_set_type($data[$j][$k][4], 'datetime');
+                xmlrpc_set_type($data[$j][$k][8], 'datetime');
+            }
+        $out = xmlrpc_encode($data);
+    }
+    end_test('Data encoding (large array)', 'xmlrpc-epi encoding', $out);
+    }
+
+    // test 'old style' data decoding vs. 'automatic style' decoding
+    $dummy = new xmlrpcmsg('');
+    $out = new xmlrpcresp($value);
+    $in = '<?xml version="1.0" ?>'."\n".$out->serialize();
+
+    begin_test('Data decoding (large array)', 'manual decoding');
+    for ($i = 0; $i < $num_tests; $i++)
+    {
+        $response =& $dummy->ParseResponse($in, true);
+        $value = $response->value();
+        $result = array();
+        for ($k = 0; $k < $value->arraysize(); $k++)
+        {
+            $val1 = $value->arraymem($k);
+            $out = array();
+            while (list($name, $val) = $val1->structeach())
+            {
+                $out[$name] = array();
+                for ($j = 0; $j < $val->arraysize(); $j++)
+                {
+                    $data = $val->arraymem($j);
+                    $out[$name][] = $data->scalarval();
+                }
+            } // while
+            $result[] = $out;
+        }
+    }
+    end_test('Data decoding (large array)', 'manual decoding', $result);
+
+    begin_test('Data decoding (large array)', 'automatic decoding');
+    for ($i = 0; $i < $num_tests; $i++)
+    {
+        $response =& $dummy->ParseResponse($in, true, 'phpvals');
+        $value = $response->value();
+    }
+    end_test('Data decoding (large array)', 'automatic decoding', $value);
+
+    if (function_exists('xmlrpc_decode'))
+    {
+    begin_test('Data decoding (large array)', 'xmlrpc-epi decoding');
+    for ($i = 0; $i < $num_tests; $i++)
+    {
+        $response =& $dummy->ParseResponse($in, true, 'xml');
+        $value = xmlrpc_decode($response->value());
+    }
+    end_test('Data decoding (large array)', 'xmlrpc-epi decoding', $value);
+    }
+
+    if (!$xd) {
+
+    /// test multicall vs. many calls vs. keep-alives
+    $value = php_xmlrpc_encode($data1, array('auto_dates'));
+    $msg = new xmlrpcmsg('interopEchoTests.echoValue', array($value));
+    $msgs=array();
+    for ($i = 0; $i < 25; $i++)
+        $msgs[] = $msg;
+    $server = explode(':', $LOCALSERVER);
+    if(count($server) > 1)
+    {
+        $c = new xmlrpc_client($URI, $server[0], $server[1]);
+    }
+    else
+    {
+        $c = new xmlrpc_client($URI, $LOCALSERVER);
+    }
+    // do not interfere with http compression
+    $c->accepted_compression = array();
+    //$c->debug=true;
+
+    if (function_exists('gzinflate')) {
+        $c->accepted_compression = null;
+    }
+    begin_test('Repeated send (small array)', 'http 10');
+    $response = array();
+    for ($i = 0; $i < 25; $i++)
+    {
+        $resp =& $c->send($msg);
+        $response[] = $resp->value();
+    }
+    end_test('Repeated send (small array)', 'http 10', $response);
+
+    if (function_exists('curl_init'))
+    {
+        begin_test('Repeated send (small array)', 'http 11 w. keep-alive');
+        $response = array();
+        for ($i = 0; $i < 25; $i++)
+        {
+            $resp =& $c->send($msg, 10, 'http11');
+            $response[] = $resp->value();
+        }
+        end_test('Repeated send (small array)', 'http 11 w. keep-alive', $response);
+
+        $c->keepalive = false;
+        begin_test('Repeated send (small array)', 'http 11');
+        $response = array();
+        for ($i = 0; $i < 25; $i++)
+        {
+            $resp =& $c->send($msg, 10, 'http11');
+            $response[] = $resp->value();
+        }
+        end_test('Repeated send (small array)', 'http 11', $response);
+    }
+
+    begin_test('Repeated send (small array)', 'multicall');
+    $response =& $c->send($msgs);
+    foreach ($response as $key =>& $val)
+    {
+        $val = $val->value();
+    }
+    end_test('Repeated send (small array)', 'multicall', $response);
+
+    if (function_exists('gzinflate'))
+    {
+        $c->accepted_compression = array('gzip');
+        $c->request_compression = 'gzip';
+
+        begin_test('Repeated send (small array)', 'http 10 w. compression');
+        $response = array();
+        for ($i = 0; $i < 25; $i++)
+        {
+            $resp =& $c->send($msg);
+            $response[] = $resp->value();
+        }
+        end_test('Repeated send (small array)', 'http 10 w. compression', $response);
 
         if (function_exists('curl_init'))
         {
@@ -257,44 +257,43 @@
             $val = $val->value();
         }
         end_test('Repeated send (small array)', 'multicall w. compression', $response);
-	}
-
-	} // end of 'if no xdebug profiling'
-
-	function begin_test($test_name, $test_case)
-	{
-		global $test_results;
-		if (!isset($test_results[$test_name]))
-			$test_results[$test_name]=array();
-		$test_results[$test_name][$test_case] = array();
-		$test_results[$test_name][$test_case]['time'] = microtime(true);
-	}
-
-	function end_test($test_name, $test_case, $test_result)
-	{
-		global $test_results;
-		$end = microtime(true);
-		if (!isset($test_results[$test_name][$test_case]))
-			trigger_error('ending test that was not sterted');
-		$test_results[$test_name][$test_case]['time'] = $end - $test_results[$test_name][$test_case]['time'];
-		$test_results[$test_name][$test_case]['result'] = $test_result;
-		echo '.';
-		flush();
-		ob_flush();
-	}
-
-
-	echo "\n";
-	foreach($test_results as $test => $results)
-	{
-		echo "\nTEST: $test\n";
-		foreach ($results as $case => $data)
-			echo "  $case: {$data['time']} secs - Output data CRC: ".crc32(serialize($data['result']))."\n";
-	}
-
-
-	if(isset($_SERVER['REQUEST_METHOD']))
-	{
-		echo "\n</pre>\n</body>\n</html>\n";
-	}
-?>
\ No newline at end of file
+    }
+
+    } // end of 'if no xdebug profiling'
+
+    function begin_test($test_name, $test_case)
+    {
+        global $test_results;
+        if (!isset($test_results[$test_name]))
+            $test_results[$test_name]=array();
+        $test_results[$test_name][$test_case] = array();
+        $test_results[$test_name][$test_case]['time'] = microtime(true);
+    }
+
+    function end_test($test_name, $test_case, $test_result)
+    {
+        global $test_results;
+        $end = microtime(true);
+        if (!isset($test_results[$test_name][$test_case]))
+            trigger_error('ending test that was not sterted');
+        $test_results[$test_name][$test_case]['time'] = $end - $test_results[$test_name][$test_case]['time'];
+        $test_results[$test_name][$test_case]['result'] = $test_result;
+        echo '.';
+        flush();
+        ob_flush();
+    }
+
+
+    echo "\n";
+    foreach($test_results as $test => $results)
+    {
+        echo "\nTEST: $test\n";
+        foreach ($results as $case => $data)
+            echo "  $case: {$data['time']} secs - Output data CRC: ".crc32(serialize($data['result']))."\n";
+    }
+
+
+    if(isset($_SERVER['REQUEST_METHOD']))
+    {
+        echo "\n</pre>\n</body>\n</html>\n";
+    }
diff --git a/test/parse_args.php b/test/parse_args.php
index 81f5bd06..60e777fc 100644
--- a/test/parse_args.php
+++ b/test/parse_args.php
@@ -13,123 +13,122 @@
  * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
  **/
 
-	require_once('xmlrpc.inc');
-	require_once('xmlrpcs.inc');
+    require_once('xmlrpc.inc');
+    require_once('xmlrpcs.inc');
 
-	// play nice to older PHP versions that miss superglobals
-	if(!isset($_SERVER))
-	{
-		$_SERVER = $HTTP_SERVER_VARS;
-		$_GET = isset($HTTP_GET_VARS) ? $HTTP_GET_VARS : array();
-		$_POST = isset($HTTP_POST_VARS) ? $HTTP_POST_VARS : array();
-	}
+    // play nice to older PHP versions that miss superglobals
+    if(!isset($_SERVER))
+    {
+        $_SERVER = $HTTP_SERVER_VARS;
+        $_GET = isset($HTTP_GET_VARS) ? $HTTP_GET_VARS : array();
+        $_POST = isset($HTTP_POST_VARS) ? $HTTP_POST_VARS : array();
+    }
 
-	// check for command line vs web page input params
-	if(!isset($_SERVER['REQUEST_METHOD']))
-	{
-		if(isset($argv))
-		{
-			foreach($argv as $param)
-			{
-				$param = explode('=', $param);
-				if(count($param) > 1)
-				{
-					$$param[0]=$param[1];
-				}
-			}
-		}
-	}
-	elseif(!ini_get('register_globals'))
-	{
-		// play nice to 'safe' PHP installations with register globals OFF
-		// NB: we might as well consider using $_GET stuff later on...
-		extract($_GET);
-		extract($_POST);
-	}
+    // check for command line vs web page input params
+    if(!isset($_SERVER['REQUEST_METHOD']))
+    {
+        if(isset($argv))
+        {
+            foreach($argv as $param)
+            {
+                $param = explode('=', $param);
+                if(count($param) > 1)
+                {
+                    $$param[0]=$param[1];
+                }
+            }
+        }
+    }
+    elseif(!ini_get('register_globals'))
+    {
+        // play nice to 'safe' PHP installations with register globals OFF
+        // NB: we might as well consider using $_GET stuff later on...
+        extract($_GET);
+        extract($_POST);
+    }
 
-	if(!isset($DEBUG))
-	{
-		$DEBUG = 0;
-	}
-	else
-	{
-		$DEBUG = intval($DEBUG);
-	}
+    if(!isset($DEBUG))
+    {
+        $DEBUG = 0;
+    }
+    else
+    {
+        $DEBUG = intval($DEBUG);
+    }
 
-	if(!isset($LOCALSERVER))
-	{
-		if(isset($HTTP_HOST))
-		{
-			$LOCALSERVER = $HTTP_HOST;
-		}
-		elseif(isset($_SERVER['HTTP_HOST']))
-		{
-			$LOCALSERVER = $_SERVER['HTTP_HOST'];
-		}
-		else
-		{
-			$LOCALSERVER = 'localhost';
-		}
-	}
-	if(!isset($HTTPSSERVER))
-	{
-		$HTTPSSERVER = 'xmlrpc.usefulinc.com';
-	}
-	if(!isset($HTTPSURI))
-	{
-		$HTTPSURI = '/server.php';
-	}
-	if(!isset($HTTPSIGNOREPEER))
-	{
-		$HTTPSIGNOREPEER = false;
-	}
-	if(!isset($PROXY))
-	{
-		$PROXYSERVER = null;
-	}
-	else
-	{
-		$arr = explode(':',$PROXY);
-		$PROXYSERVER = $arr[0];
-		if(count($arr) > 1)
-		{
-			$PROXYPORT = $arr[1];
-		}
-		else
-		{
-			$PROXYPORT = 8080;
-		}
-	}
-	if(!isset($URI))
-	{
-		// GUESTIMATE the url of local demo server
-		// play nice to php 3 and 4-5 in retrieving URL of server.php
-		/// @todo filter out query string from REQUEST_URI
-		if(isset($REQUEST_URI))
-		{
-			$URI = str_replace('/test/testsuite.php', '/demo/server/server.php', $REQUEST_URI);
-			$URI = str_replace('/testsuite.php', '/server.php', $URI);
-			$URI = str_replace('/test/benchmark.php', '/demo/server/server.php', $URI);
-			$URI = str_replace('/benchmark.php', '/server.php', $URI);
-		}
-		elseif(isset($_SERVER['PHP_SELF']) && isset($_SERVER['REQUEST_METHOD']))
-		{
-			$URI = str_replace('/test/testsuite.php', '/demo/server/server.php', $_SERVER['PHP_SELF']);
-			$URI = str_replace('/testsuite.php', '/server.php', $URI);
-			$URI = str_replace('/test/benchmark.php', '/demo/server/server.php', $URI);
-			$URI = str_replace('/benchmark.php', '/server.php', $URI);
-		}
-		else
-		{
-			$URI = '/demo/server/server.php';
-		}
-	}
-	if($URI[0] != '/')
-	{
-		$URI = '/'.$URI;
-	}
-	if(!isset($LOCALPATH))
-	{
-		$LOCALPATH = dirname(__FILE__);
-	}
-?>
\ No newline at end of file
+    if(!isset($LOCALSERVER))
+    {
+        if(isset($HTTP_HOST))
+        {
+            $LOCALSERVER = $HTTP_HOST;
+        }
+        elseif(isset($_SERVER['HTTP_HOST']))
+        {
+            $LOCALSERVER = $_SERVER['HTTP_HOST'];
+        }
+        else
+        {
+            $LOCALSERVER = 'localhost';
+        }
+    }
+    if(!isset($HTTPSSERVER))
+    {
+        $HTTPSSERVER = 'xmlrpc.usefulinc.com';
+    }
+    if(!isset($HTTPSURI))
+    {
+        $HTTPSURI = '/server.php';
+    }
+    if(!isset($HTTPSIGNOREPEER))
+    {
+        $HTTPSIGNOREPEER = false;
+    }
+    if(!isset($PROXY))
+    {
+        $PROXYSERVER = null;
+    }
+    else
+    {
+        $arr = explode(':',$PROXY);
+        $PROXYSERVER = $arr[0];
+        if(count($arr) > 1)
+        {
+            $PROXYPORT = $arr[1];
+        }
+        else
+        {
+            $PROXYPORT = 8080;
+        }
+    }
+    if(!isset($URI))
+    {
+        // GUESTIMATE the url of local demo server
+        // play nice to php 3 and 4-5 in retrieving URL of server.php
+        /// @todo filter out query string from REQUEST_URI
+        if(isset($REQUEST_URI))
+        {
+            $URI = str_replace('/test/testsuite.php', '/demo/server/server.php', $REQUEST_URI);
+            $URI = str_replace('/testsuite.php', '/server.php', $URI);
+            $URI = str_replace('/test/benchmark.php', '/demo/server/server.php', $URI);
+            $URI = str_replace('/benchmark.php', '/server.php', $URI);
+        }
+        elseif(isset($_SERVER['PHP_SELF']) && isset($_SERVER['REQUEST_METHOD']))
+        {
+            $URI = str_replace('/test/testsuite.php', '/demo/server/server.php', $_SERVER['PHP_SELF']);
+            $URI = str_replace('/testsuite.php', '/server.php', $URI);
+            $URI = str_replace('/test/benchmark.php', '/demo/server/server.php', $URI);
+            $URI = str_replace('/benchmark.php', '/server.php', $URI);
+        }
+        else
+        {
+            $URI = '/demo/server/server.php';
+        }
+    }
+    if($URI[0] != '/')
+    {
+        $URI = '/'.$URI;
+    }
+    if(!isset($LOCALPATH))
+    {
+        $LOCALPATH = dirname(__FILE__);
+    }
diff --git a/test/testsuite.php b/test/testsuite.php
index dbbfa0b1..202bbc3c 100644
--- a/test/testsuite.php
+++ b/test/testsuite.php
@@ -1521,4 +1521,3 @@ Proxy Server: <input name="PROXY" size="30" value="<?php echo isset($PROXY) ? ht
 <?php
 echo $result->toHTML()."\n</body>\n</html>\n";
 }
-?>
\ No newline at end of file
-- 
2.47.0