3 include(dirname(__FILE__).'/parse_args.php');
5 require_once('xmlrpc.inc');
6 require_once('xmlrpcs.inc');
7 require_once('xmlrpc_wrappers.inc');
9 require_once 'phpunit.php';
10 //require_once 'PHPUnit/TestDecorator.php';
12 // let testuite run for the needed time
13 if ((int)ini_get('max_execution_time') < 180)
14 ini_set('max_execution_time', 180);
16 $suite = new PHPUnit_TestSuite();
18 // array with list of failed tests
19 $failed_tests = array();
21 class LocalhostTests extends PHPUnit_TestCase
26 var $request_compression = null;
27 var $accepted_compression = '';
29 function fail($message = '')
31 PHPUnit_TestCase::fail($message);
32 // save in global var that this particular test has failed
33 // (but only if not called from subclass objects / multitests)
34 if (function_exists('debug_backtrace') && strtolower(get_class($this)) == 'localhosttests')
37 $trace = debug_backtrace();
38 for ($i = 0; $i < count($trace); $i++)
40 if (strpos($trace[$i]['function'], 'test') === 0)
42 $failed_tests[$trace[$i]['function']] = true;
51 global $DEBUG, $LOCALSERVER, $URI;
52 $server = explode(':', $LOCALSERVER);
53 if(count($server) > 1)
55 $this->client=new xmlrpc_client($URI, $server[0], $server[1]);
59 $this->client=new xmlrpc_client($URI, $LOCALSERVER);
63 $this->client->setDebug($DEBUG);
65 $this->client->request_compression = $this->request_compression;
66 $this->client->accepted_compression = $this->accepted_compression;
69 function send($msg, $errrorcode=0, $return_response=false)
71 $r = $this->client->send($msg, $this->timeout, $this->method);
72 // for multicall, return directly array of responses
77 $this->assertEquals($r->faultCode(), $errrorcode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
93 $sendstring="here are 3 \"entities\": < > & " .
94 "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) .
95 " - isn't that great? \\\"hackery\\\" at it's best " .
96 " also don't want to miss out on \$item[0]. ".
97 "The real weird stuff follows: CRLF here".chr(13).chr(10).
98 "a simple CR here".chr(13).
99 "a simple LF here".chr(10).
100 "and then LFCR".chr(10).chr(13).
101 "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->";
102 $f=new xmlrpcmsg('examples.stringecho', array(
103 new xmlrpcval($sendstring, 'string')
108 // when sending/receiving non-US-ASCII encoded strings, XML says cr-lf can be normalized.
109 // so we relax our tests...
110 $l1 = strlen($sendstring);
111 $l2 = strlen($v->scalarval());
113 $this->assertEquals($sendstring, $v->scalarval());
115 $this->assertEquals(str_replace(array("\r\n", "\r"), array("\n", "\n"), $sendstring), $v->scalarval());
119 function testAddingDoubles()
121 // note that rounding errors mean we
122 // keep precision to sensible levels here ;-)
124 $f=new xmlrpcmsg('examples.addtwodouble',array(
125 new xmlrpcval($a, 'double'),
126 new xmlrpcval($b, 'double')
131 $this->assertEquals($a+$b,$v->scalarval());
135 function testAdding()
137 $f=new xmlrpcmsg('examples.addtwo',array(
138 new xmlrpcval(12, 'int'),
139 new xmlrpcval(-23, 'int')
144 $this->assertEquals(12-23, $v->scalarval());
148 function testInvalidNumber()
150 $f=new xmlrpcmsg('examples.addtwo',array(
151 new xmlrpcval('fred', 'int'),
152 new xmlrpcval("\"; exec('ls')", 'int')
155 /// @todo a fault condition should be generated here
156 /// by the server, which we pick up on
159 $this->assertEquals(0, $v->scalarval());
163 function testBoolean()
165 $f=new xmlrpcmsg('examples.invertBooleans', array(
167 new xmlrpcval(true, 'boolean'),
168 new xmlrpcval(false, 'boolean'),
169 new xmlrpcval(1, 'boolean'),
170 new xmlrpcval(0, 'boolean'),
171 //new xmlrpcval('true', 'boolean'),
172 //new xmlrpcval('false', 'boolean')
182 for($i=0; $i<$sz; $i++)
194 $this->assertEquals($answer, $got);
198 function testBase64()
200 $sendstring='Mary had a little lamb,
201 Whose fleece was white as snow,
202 And everywhere that Mary went
203 the lamb was sure to go.
205 Mary had a little lamb
206 She tied it to a pylon
207 Ten thousand volts went down its back
208 And turned it into nylon';
209 $f=new xmlrpcmsg('examples.decode64',array(
210 new xmlrpcval($sendstring, 'base64')
215 if (strlen($sendstring) == strlen($v->scalarval()))
216 $this->assertEquals($sendstring, $v->scalarval());
218 $this->assertEquals(str_replace(array("\r\n", "\r"), array("\n", "\n"), $sendstring), $v->scalarval());
222 function testDateTime()
225 $t1 = new xmlrpcval($time, 'dateTime.iso8601');
226 $t2 = new xmlrpcval(iso8601_encode($time), 'dateTime.iso8601');
227 $this->assertEquals($t1->serialize(), $t2->serialize());
228 if (class_exists('DateTime'))
230 $datetime = new DateTime();
231 // skip this test for php 5.2. It is a bit harder there to build a DateTime from unix timestamp with proper TZ info
232 if(is_callable(array($datetime,'setTimestamp')))
234 $t3 = new xmlrpcval($datetime->setTimestamp($time), 'dateTime.iso8601');
235 $this->assertEquals($t1->serialize(), $t3->serialize());
240 function testCountEntities()
242 $sendstring = "h'fd>onc>>l>>rw&bpu>q>e<v&gxs<ytjzkami<";
243 $f = new xmlrpcmsg('validator1.countTheEntities',array(
244 new xmlrpcval($sendstring, 'string')
246 $v = $this->send($f);
251 $expect_array = array('ctLeftAngleBrackets','ctRightAngleBrackets','ctAmpersands','ctApostrophes','ctQuotes');
252 while(list(,$val) = each($expect_array))
254 $b = $v->structmem($val);
255 $got .= $b->me['int'];
257 $this->assertEquals($expected, $got);
261 function _multicall_msg($method, $params)
263 $struct['methodName'] = new xmlrpcval($method, 'string');
264 $struct['params'] = new xmlrpcval($params, 'array');
265 return new xmlrpcval($struct, 'struct');
268 function testServerMulticall()
270 // We manually construct a system.multicall() call to ensure
271 // that the server supports it.
273 // NB: This test will NOT pass if server does not support system.multicall.
275 // Based on http://xmlrpc-c.sourceforge.net/hacks/test_multicall.py
276 $good1 = $this->_multicall_msg(
278 array(php_xmlrpc_encode('system.listMethods')));
279 $bad = $this->_multicall_msg(
281 array(php_xmlrpc_encode(1), php_xmlrpc_encode(2)));
282 $recursive = $this->_multicall_msg(
284 array(new xmlrpcval(array(), 'array')));
285 $good2 = $this->_multicall_msg(
286 'system.methodSignature',
287 array(php_xmlrpc_encode('system.listMethods')));
288 $arg = new xmlrpcval(
289 array($good1, $bad, $recursive, $good2),
293 $f = new xmlrpcmsg('system.multicall', array($arg));
294 $v = $this->send($f);
297 //$this->assertTrue($r->faultCode() == 0, "fault from system.multicall");
298 $this->assertTrue($v->arraysize() == 4, "bad number of return values");
300 $r1 = $v->arraymem(0);
302 $r1->kindOf() == 'array' && $r1->arraysize() == 1,
303 "did not get array of size 1 from good1"
306 $r2 = $v->arraymem(1);
308 $r2->kindOf() == 'struct',
312 $r3 = $v->arraymem(2);
314 $r3->kindOf() == 'struct',
315 "recursive system.multicall did not fail"
318 $r4 = $v->arraymem(3);
320 $r4->kindOf() == 'array' && $r4->arraysize() == 1,
321 "did not get array of size 1 from good2"
326 function testClientMulticall1()
328 // NB: This test will NOT pass if server does not support system.multicall.
330 $this->client->no_multicall = false;
332 $good1 = new xmlrpcmsg('system.methodHelp',
333 array(php_xmlrpc_encode('system.listMethods')));
334 $bad = new xmlrpcmsg('test.nosuch',
335 array(php_xmlrpc_encode(1), php_xmlrpc_encode(2)));
336 $recursive = new xmlrpcmsg('system.multicall',
337 array(new xmlrpcval(array(), 'array')));
338 $good2 = new xmlrpcmsg('system.methodSignature',
339 array(php_xmlrpc_encode('system.listMethods'))
342 $r = $this->send(array($good1, $bad, $recursive, $good2));
345 $this->assertTrue(count($r) == 4, "wrong number of return values");
348 $this->assertTrue($r[0]->faultCode() == 0, "fault from good1");
349 if(!$r[0]->faultCode())
351 $val = $r[0]->value();
353 $val->kindOf() == 'scalar' && $val->scalartyp() == 'string',
354 "good1 did not return string"
357 $this->assertTrue($r[1]->faultCode() != 0, "no fault from bad");
358 $this->assertTrue($r[2]->faultCode() != 0, "no fault from recursive system.multicall");
359 $this->assertTrue($r[3]->faultCode() == 0, "fault from good2");
360 if(!$r[3]->faultCode())
362 $val = $r[3]->value();
363 $this->assertTrue($val->kindOf() == 'array', "good2 did not return array");
365 // This is the only assert in this test which should fail
366 // if the test server does not support system.multicall.
367 $this->assertTrue($this->client->no_multicall == false,
368 "server does not support system.multicall"
372 function testClientMulticall2()
374 // NB: This test will NOT pass if server does not support system.multicall.
376 $this->client->no_multicall = true;
378 $good1 = new xmlrpcmsg('system.methodHelp',
379 array(php_xmlrpc_encode('system.listMethods')));
380 $bad = new xmlrpcmsg('test.nosuch',
381 array(php_xmlrpc_encode(1), php_xmlrpc_encode(2)));
382 $recursive = new xmlrpcmsg('system.multicall',
383 array(new xmlrpcval(array(), 'array')));
384 $good2 = new xmlrpcmsg('system.methodSignature',
385 array(php_xmlrpc_encode('system.listMethods'))
388 $r = $this->send(array($good1, $bad, $recursive, $good2));
391 $this->assertTrue(count($r) == 4, "wrong number of return values");
394 $this->assertTrue($r[0]->faultCode() == 0, "fault from good1");
395 if(!$r[0]->faultCode())
397 $val = $r[0]->value();
399 $val->kindOf() == 'scalar' && $val->scalartyp() == 'string',
400 "good1 did not return string");
402 $this->assertTrue($r[1]->faultCode() != 0, "no fault from bad");
403 $this->assertTrue($r[2]->faultCode() == 0, "fault from (non recursive) system.multicall");
404 $this->assertTrue($r[3]->faultCode() == 0, "fault from good2");
405 if(!$r[3]->faultCode())
407 $val = $r[3]->value();
408 $this->assertTrue($val->kindOf() == 'array', "good2 did not return array");
412 function testClientMulticall3()
414 // NB: This test will NOT pass if server does not support system.multicall.
416 $this->client->return_type = 'phpvals';
417 $this->client->no_multicall = false;
419 $good1 = new xmlrpcmsg('system.methodHelp',
420 array(php_xmlrpc_encode('system.listMethods')));
421 $bad = new xmlrpcmsg('test.nosuch',
422 array(php_xmlrpc_encode(1), php_xmlrpc_encode(2)));
423 $recursive = new xmlrpcmsg('system.multicall',
424 array(new xmlrpcval(array(), 'array')));
425 $good2 = new xmlrpcmsg('system.methodSignature',
426 array(php_xmlrpc_encode('system.listMethods'))
429 $r = $this->send(array($good1, $bad, $recursive, $good2));
432 $this->assertTrue(count($r) == 4, "wrong number of return values");
434 $this->assertTrue($r[0]->faultCode() == 0, "fault from good1");
435 if(!$r[0]->faultCode())
437 $val = $r[0]->value();
439 is_string($val) , "good1 did not return string");
441 $this->assertTrue($r[1]->faultCode() != 0, "no fault from bad");
442 $this->assertTrue($r[2]->faultCode() != 0, "no fault from recursive system.multicall");
443 $this->assertTrue($r[3]->faultCode() == 0, "fault from good2");
444 if(!$r[3]->faultCode())
446 $val = $r[3]->value();
447 $this->assertTrue(is_array($val), "good2 did not return array");
449 $this->client->return_type = 'xmlrpcvals';
452 function testCatchWarnings()
454 $f = new xmlrpcmsg('examples.generatePHPWarning', array(
455 new xmlrpcval('whatever', 'string')
457 $v = $this->send($f);
460 $this->assertEquals($v->scalarval(), true);
464 function testCatchExceptions()
467 $f = new xmlrpcmsg('examples.raiseException', array(
468 new xmlrpcval('whatever', 'string')
470 $v = $this->send($f, $GLOBALS['xmlrpcerr']['server_error']);
471 $this->client->path = $URI.'?EXCEPTION_HANDLING=1';
472 $v = $this->send($f, 1);
473 $this->client->path = $URI.'?EXCEPTION_HANDLING=2';
474 $v = $this->send($f, $GLOBALS['xmlrpcerr']['invalid_return']);
477 function testZeroParams()
479 $f = new xmlrpcmsg('system.listMethods');
480 $v = $this->send($f);
483 function testCodeInjectionServerSide()
485 $f = new xmlrpcmsg('system.MethodHelp');
486 $f->payload = "<?xml version=\"1.0\"?><methodCall><methodName>validator1.echoStructTest</methodName><params><param><value><struct><member><name>','')); echo('gotcha!'); die(); //</name></member></struct></value></param></params></methodCall>";
487 $v = $this->send($f);
488 //$v = $r->faultCode();
491 $this->assertEquals(0, $v->structsize());
495 function testAutoRegisteredFunction()
497 $f=new xmlrpcmsg('examples.php.getStateName',array(
498 new xmlrpcval(23, 'int')
503 $this->assertEquals('Michigan', $v->scalarval());
507 $this->fail('Note: server can only auto register functions if running with PHP 5.0.3 and up');
511 function testAutoRegisteredClass()
513 $f=new xmlrpcmsg('examples.php2.getStateName',array(
514 new xmlrpcval(23, 'int')
519 $this->assertEquals('Michigan', $v->scalarval());
520 $f=new xmlrpcmsg('examples.php3.getStateName',array(
521 new xmlrpcval(23, 'int')
526 $this->assertEquals('Michigan', $v->scalarval());
531 $this->fail('Note: server can only auto register class methods if running with PHP 5.0.3 and up');
535 function testAutoRegisteredMethod()
537 // make a 'deep client copy' as the original one might have many properties set
538 $func=wrap_xmlrpc_method($this->client, 'examples.getStateName', array('simple_client_copy' => 1));
541 $this->fail('Registration of examples.getStateName failed');
546 // work around bug in current version of phpunit
549 $v = var_export($v, true);
551 $this->assertEquals('Michigan', $v);
555 function testGetCookies()
557 // let server set to us some cookies we tell it
560 'c2' => array('value' => 'c2'),
561 'c3' => array('value' => 'c3', 'expires' => time()+60*60*24*30),
562 'c4' => array('value' => 'c4', 'expires' => time()+60*60*24*30, 'path' => '/'),
563 'c5' => array('value' => 'c5', 'expires' => time()+60*60*24*30, 'path' => '/', 'domain' => 'localhost'),
565 $cookiesval = php_xmlrpc_encode($cookies);
566 $f=new xmlrpcmsg('examples.setcookies',array($cookiesval));
567 $r=$this->send($f, 0, true);
571 $this->assertEquals(1, $v->scalarval());
572 // now check if we decoded the cookies as we had set them
573 $rcookies = $r->cookies();
574 // remove extra cookies which might have been set by proxies
575 foreach($rcookies as $c => $v)
577 if(!in_array($c, array('c2', 'c3', 'c4', 'c5')))
578 unset($rcookies[$c]);
579 // Seems like we get this when using php-fpm and php 5.5+ ...
580 if (isset($rcookies[$c]['Max-Age']))
582 unset($rcookies[$c]['Max-Age']);
585 foreach($cookies as $c => $v)
586 // format for date string in cookies: 'Mon, 31 Oct 2005 13:50:56 GMT'
587 // but PHP versions differ on that, some use 'Mon, 31-Oct-2005 13:50:56 GMT'...
588 if(isset($v['expires']))
590 if (isset($rcookies[$c]['expires']) && strpos($rcookies[$c]['expires'], '-'))
592 $cookies[$c]['expires'] = gmdate('D, d\-M\-Y H:i:s \G\M\T' ,$cookies[$c]['expires']);
596 $cookies[$c]['expires'] = gmdate('D, d M Y H:i:s \G\M\T' ,$cookies[$c]['expires']);
599 $this->assertEquals($cookies, $rcookies);
603 function testSetCookies()
605 // let server set to us some cookies we tell it
610 'c3' => '!@#$%^&*()_+|}{":?><,./\';[]\\=-'
612 $f=new xmlrpcmsg('examples.getcookies',array());
613 foreach ($cookies as $cookie => $val)
615 $this->client->setCookie($cookie, $val);
616 $cookies[$cookie] = (string) $cookies[$cookie];
618 $r = $this->client->send($f, $this->timeout, $this->method);
619 $this->assertEquals($r->faultCode(), 0, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
623 $v = php_xmlrpc_decode($v);
624 // on IIS and Apache getallheaders returns something slightly different...
625 $this->assertEquals($v, $cookies);
629 function testSendTwiceSameMsg()
631 $f=new xmlrpcmsg('examples.stringecho', array(
632 new xmlrpcval('hello world', 'string')
634 $v1 = $this->send($f);
635 $v2 = $this->send($f);
636 //$v = $r->faultCode();
639 $this->assertEquals($v2, $v1);
644 class LocalHostMultiTests extends LocalhostTests
648 global $failed_tests;
649 foreach(get_class_methods('LocalhostTests') as $meth)
651 if(strpos($meth, 'test') === 0 && $meth != 'testHttps' && $meth != 'testCatchExceptions')
653 if (!isset($failed_tests[$meth]))
665 function testDeflate()
667 if(!function_exists('gzdeflate'))
669 $this->fail('Zlib missing: cannot test deflate functionality');
672 $this->client->accepted_compression = array('deflate');
673 $this->client->request_compression = 'deflate';
679 if(!function_exists('gzdeflate'))
681 $this->fail('Zlib missing: cannot test gzip functionality');
684 $this->client->accepted_compression = array('gzip');
685 $this->client->request_compression = 'gzip';
689 function testKeepAlives()
691 if(!function_exists('curl_init'))
693 $this->fail('CURL missing: cannot test http 1.1');
696 $this->method = 'http11';
697 $this->client->keepalive = true;
703 global $PROXYSERVER, $PROXYPORT, $NOPROXY;
706 $this->client->setProxy($PROXYSERVER, $PROXYPORT);
711 $this->fail('PROXY definition missing: cannot test proxy');
714 function testHttp11()
716 if(!function_exists('curl_init'))
718 $this->fail('CURL missing: cannot test http 1.1');
721 $this->method = 'http11'; // not an error the double assignment!
722 $this->client->method = 'http11';
723 //$this->client->verifyhost = 0;
724 //$this->client->verifypeer = 0;
725 $this->client->keepalive = false;
729 function testHttp11Gzip()
731 if(!function_exists('curl_init'))
733 $this->fail('CURL missing: cannot test http 1.1');
736 $this->method = 'http11'; // not an error the double assignment!
737 $this->client->method = 'http11';
738 $this->client->keepalive = false;
739 $this->client->accepted_compression = array('gzip');
740 $this->client->request_compression = 'gzip';
744 function testHttp11Deflate()
746 if(!function_exists('curl_init'))
748 $this->fail('CURL missing: cannot test http 1.1');
751 $this->method = 'http11'; // not an error the double assignment!
752 $this->client->method = 'http11';
753 $this->client->keepalive = false;
754 $this->client->accepted_compression = array('deflate');
755 $this->client->request_compression = 'deflate';
759 function testHttp11Proxy()
761 global $PROXYSERVER, $PROXYPORT, $NOPROXY;
762 if(!function_exists('curl_init'))
764 $this->fail('CURL missing: cannot test http 1.1 w. proxy');
767 else if ($PROXYSERVER == '')
770 $this->fail('PROXY definition missing: cannot test proxy w. http 1.1');
773 $this->method = 'http11'; // not an error the double assignment!
774 $this->client->method = 'http11';
775 $this->client->setProxy($PROXYSERVER, $PROXYPORT);
776 //$this->client->verifyhost = 0;
777 //$this->client->verifypeer = 0;
778 $this->client->keepalive = false;
784 global $HTTPSSERVER, $HTTPSURI, $HTTPSIGNOREPEER, $HTTPSVERIFYHOST;
785 if(!function_exists('curl_init'))
787 $this->fail('CURL missing: cannot test https functionality');
790 $this->client->server = $HTTPSSERVER;
791 $this->method = 'https';
792 $this->client->method = 'https';
793 $this->client->path = $HTTPSURI;
794 $this->client->setSSLVerifyPeer(!$HTTPSIGNOREPEER);
795 $this->client->setSSLVerifyHost($HTTPSVERIFYHOST);
799 function testHttpsProxy()
801 global $HTTPSSERVER, $HTTPSURI, $HTTPSIGNOREPEER, $HTTPSVERIFYHOST, $PROXYSERVER, $PROXYPORT, $NOPROXY;
802 if(!function_exists('curl_init'))
804 $this->fail('CURL missing: cannot test https functionality');
807 else if ($PROXYSERVER == '')
810 $this->fail('PROXY definition missing: cannot test proxy w. http 1.1');
813 $this->client->server = $HTTPSSERVER;
814 $this->method = 'https';
815 $this->client->method = 'https';
816 $this->client->setProxy($PROXYSERVER, $PROXYPORT);
817 $this->client->path = $HTTPSURI;
818 $this->client->setSSLVerifyPeer(!$HTTPSIGNOREPEER);
819 $this->client->setSSLVerifyHost($HTTPSVERIFYHOST);
823 function testUTF8Responses()
826 //$this->client->path = strpos($URI, '?') === null ? $URI.'?RESPONSE_ENCODING=UTF-8' : $URI.'&RESPONSE_ENCODING=UTF-8';
827 $this->client->path = $URI.'?RESPONSE_ENCODING=UTF-8';
831 function testUTF8Requests()
833 $this->client->request_charset_encoding = 'UTF-8';
837 function testISOResponses()
840 //$this->client->path = strpos($URI, '?') === null ? $URI.'?RESPONSE_ENCODING=UTF-8' : $URI.'&RESPONSE_ENCODING=UTF-8';
841 $this->client->path = $URI.'?RESPONSE_ENCODING=ISO-8859-1';
845 function testISORequests()
847 $this->client->request_charset_encoding = 'ISO-8859-1';
852 class ParsingBugsTests extends PHPUnit_TestCase
854 function testMinusOneString()
856 $v=new xmlrpcval('-1');
857 $u=new xmlrpcval('-1', 'string');
858 $this->assertEquals($u->scalarval(), $v->scalarval());
861 function testUnicodeInMemberName(){
862 $str = "G".chr(252)."nter, El".chr(232)."ne";
863 $v = array($str => new xmlrpcval(1));
864 $r = new xmlrpcresp(new xmlrpcval($v, 'struct'));
865 $r = $r->serialize();
866 $m = new xmlrpcmsg('dummy');
867 $r = $m->parseResponse($r);
869 $this->assertEquals($v->structmemexists($str), true);
872 function testUnicodeInErrorString()
874 $response = utf8_encode(
875 '<?xml version="1.0"?>
877 <!-- found by G. giunta, covers what happens when lib receives
878 UTF8 chars in response text and comments -->
879 <!-- ���àüè -->
885 <name>faultCode</name>
886 <value><int>888</int></value>
889 <name>faultString</name>
890 <value><string>���àüè</string></value>
896 $m=new xmlrpcmsg('dummy');
897 $r=$m->parseResponse($response);
898 $v=$r->faultString();
899 $this->assertEquals('������', $v);
902 function testValidNumbers()
904 $m=new xmlrpcmsg('dummy');
906 '<?xml version="1.0"?>
913 <name>integer1</name>
914 <value><int>01</int></value>
918 <value><double>01.10</double></value>
921 <name>integer2</name>
922 <value><int>+1</int></value>
926 <value><double>+1.10</double></value>
930 <value><double>-1.10e2</double></value>
937 $r=$m->parseResponse($fp);
939 $s=$v->structmem('integer1');
940 $t=$v->structmem('float1');
941 $u=$v->structmem('integer2');
942 $w=$v->structmem('float2');
943 $x=$v->structmem('float3');
944 $this->assertEquals(1, $s->scalarval());
945 $this->assertEquals(1.1, $t->scalarval());
946 $this->assertEquals(1, $u->scalarval());
947 $this->assertEquals(1.1, $w->scalarval());
948 $this->assertEquals(-110.0, $x->scalarval());
951 function testAddScalarToStruct()
953 $v=new xmlrpcval(array('a' => 'b'), 'struct');
954 // use @ operator in case error_log gets on screen
955 $r= @$v->addscalar('c');
956 $this->assertEquals(0, $r);
959 function testAddStructToStruct()
961 $v=new xmlrpcval(array('a' => new xmlrpcval('b')), 'struct');
962 $r=$v->addstruct(array('b' => new xmlrpcval('c')));
963 $this->assertEquals(2, $v->structsize());
964 $this->assertEquals(1, $r);
965 $r=$v->addstruct(array('b' => new xmlrpcval('b')));
966 $this->assertEquals(2, $v->structsize());
969 function testAddArrayToArray()
971 $v=new xmlrpcval(array(new xmlrpcval('a'), new xmlrpcval('b')), 'array');
972 $r=$v->addarray(array(new xmlrpcval('b'), new xmlrpcval('c')));
973 $this->assertEquals(4, $v->arraysize());
974 $this->assertEquals(1, $r);
977 function testEncodeArray()
980 $v = php_xmlrpc_encode($r);
981 $this->assertEquals('array', $v->kindof());
984 function testEncodeRecursive()
986 $v = php_xmlrpc_encode(php_xmlrpc_encode('a simple string'));
987 $this->assertEquals('scalar', $v->kindof());
990 function testBrokenRequests()
992 $s = new xmlrpc_server();
993 // omitting the 'params' tag: not tolerated by the lib anymore
994 $f = '<?xml version="1.0"?>
996 <methodName>system.methodHelp</methodName>
998 <value><string>system.methodHelp</string></value>
1001 $r = $s->parserequest($f);
1002 $this->assertEquals(15, $r->faultCode());
1003 // omitting a 'param' tag
1004 $f = '<?xml version="1.0"?>
1006 <methodName>system.methodHelp</methodName>
1008 <value><string>system.methodHelp</string></value>
1011 $r = $s->parserequest($f);
1012 $this->assertEquals(15, $r->faultCode());
1013 // omitting a 'value' tag
1014 $f = '<?xml version="1.0"?>
1016 <methodName>system.methodHelp</methodName>
1018 <param><string>system.methodHelp</string></param>
1021 $r = $s->parserequest($f);
1022 $this->assertEquals(15, $r->faultCode());
1025 function testBrokenResponses()
1027 $m=new xmlrpcmsg('dummy');
1029 // omitting the 'params' tag: no more tolerated by the lib...
1030 $f = '<?xml version="1.0"?>
1033 <value><string>system.methodHelp</string></value>
1036 $r = $m->parseResponse($f);
1037 $this->assertEquals(2, $r->faultCode());
1038 // omitting the 'param' tag: no more tolerated by the lib...
1039 $f = '<?xml version="1.0"?>
1042 <value><string>system.methodHelp</string></value>
1045 $r = $m->parseResponse($f);
1046 $this->assertEquals(2, $r->faultCode());
1047 // omitting a 'value' tag: KO
1048 $f = '<?xml version="1.0"?>
1051 <param><string>system.methodHelp</string></param>
1054 $r = $m->parseResponse($f);
1055 $this->assertEquals(2, $r->faultCode());
1058 function testBuggyHttp()
1060 $s = new xmlrpcmsg('dummy');
1061 $f = 'HTTP/1.1 100 Welcome to the jungle
1064 X-Content-Marx-Brothers: Harpo
1066 Content-Length: who knows?
1070 <?xml version="1.0"?>
1071 <!-- First of all, let\'s check out if the lib properly handles a commented </methodResponse> tag... -->
1072 <methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
1073 <member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>hello world. 2 newlines follow
1076 and there they were.</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
1077 <script type="text\javascript">document.write(\'Hello, my name is added nag, I\\\'m happy to serve your content for free\');</script>
1079 $r = $s->parseResponse($f);
1081 $s = $v->structmem('content');
1082 $this->assertEquals("hello world. 2 newlines follow\n\n\nand there they were.", $s->scalarval());
1085 function testStringBug()
1087 $s = new xmlrpcmsg('dummy');
1088 $f = '<?xml version="1.0"?>
1090 <!-- found by 2z69xks7bpy001@sneakemail.com, amongst others
1091 covers what happens when there\'s character data after </string>
1092 and before </value> -->
1099 <name>success</name>
1101 <boolean>1</boolean>
1105 <name>sessionID</name>
1107 <string>S300510007I</string>
1114 </methodResponse> ';
1115 $r = $s->parseResponse($f);
1117 $s = $v->structmem('sessionID');
1118 $this->assertEquals('S300510007I', $s->scalarval());
1121 function testWhiteSpace()
1123 $s = new xmlrpcmsg('dummy');
1124 $f = '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
1125 <member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>hello world. 2 newlines follow
1128 and there they were.</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
1130 $r = $s->parseResponse($f);
1132 $s = $v->structmem('content');
1133 $this->assertEquals("hello world. 2 newlines follow\n\n\nand there they were.", $s->scalarval());
1136 function testDoubleDataInArrayTag()
1138 $s = new xmlrpcmsg('dummy');
1139 $f = '<?xml version="1.0"?><methodResponse><params><param><value><array>
1142 </array></value></param></params></methodResponse>
1144 $r = $s->parseResponse($f);
1145 $v = $r->faultCode();
1146 $this->assertEquals(2, $v);
1147 $f = '<?xml version="1.0"?><methodResponse><params><param><value><array>
1148 <data><value>Hello world</value></data>
1150 </array></value></param></params></methodResponse>
1152 $r = $s->parseResponse($f);
1153 $v = $r->faultCode();
1154 $this->assertEquals(2, $v);
1157 function testDoubleStuffInValueTag()
1159 $s = new xmlrpcmsg('dummy');
1160 $f = '<?xml version="1.0"?><methodResponse><params><param><value>
1161 <string>hello world</string>
1162 <array><data></data></array>
1163 </value></param></params></methodResponse>
1165 $r = $s->parseResponse($f);
1166 $v = $r->faultCode();
1167 $this->assertEquals(2, $v);
1168 $f = '<?xml version="1.0"?><methodResponse><params><param><value>
1169 <string>hello</string>
1170 <string>world</string>
1171 </value></param></params></methodResponse>
1173 $r = $s->parseResponse($f);
1174 $v = $r->faultCode();
1175 $this->assertEquals(2, $v);
1176 $f = '<?xml version="1.0"?><methodResponse><params><param><value>
1177 <string>hello</string>
1178 <struct><member><name>hello><value>world</value></member></struct>
1179 </value></param></params></methodResponse>
1181 $r = $s->parseResponse($f);
1182 $v = $r->faultCode();
1183 $this->assertEquals(2, $v);
1186 function testAutodecodeResponse()
1188 $s = new xmlrpcmsg('dummy');
1189 $f = '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
1190 <member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>hello world. 2 newlines follow
1193 and there they were.</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
1195 $r = $s->parseResponse($f, true, 'phpvals');
1198 $this->assertEquals("hello world. 2 newlines follow\n\n\nand there they were.", $s);
1201 function testNoDecodeResponse()
1203 $s = new xmlrpcmsg('dummy');
1204 $f = '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
1205 <member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>hello world. 2 newlines follow
1208 and there they were.</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>';
1209 $r = $s->parseResponse($f, true, 'xml');
1211 $this->assertEquals($f, $v);
1214 function testAutoCoDec()
1216 $data1 = array(1, 1.0, 'hello world', true, '20051021T23:43:00', -1, 11.0, '~!@#$%^&*()_+|', false, '20051021T23:43:00');
1217 $data2 = array('zero' => $data1, 'one' => $data1, 'two' => $data1, 'three' => $data1, 'four' => $data1, 'five' => $data1, 'six' => $data1, 'seven' => $data1, 'eight' => $data1, 'nine' => $data1);
1218 $data = array($data2, $data2, $data2, $data2, $data2, $data2, $data2, $data2, $data2, $data2);
1219 //$keys = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
1220 $v1 = php_xmlrpc_encode($data, array('auto_dates'));
1221 $v2 = php_xmlrpc_decode_xml($v1->serialize());
1222 $this->assertEquals($v1, $v2);
1223 $r1 = new xmlrpcresp($v1);
1224 $r2 = php_xmlrpc_decode_xml($r1->serialize());
1225 $r2->serialize(); // needed to set internal member payload
1226 $this->assertEquals($r1, $r2);
1227 $m1 = new xmlrpcmsg('hello dolly', array($v1));
1228 $m2 = php_xmlrpc_decode_xml($m1->serialize());
1229 $m2->serialize(); // needed to set internal member payload
1230 $this->assertEquals($m1, $m2);
1233 function testUTF8Request()
1235 $sendstring='κόσμε'; // Greek word 'kosme'. NB: NOT a valid ISO8859 string!
1236 $GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';
1237 $f = new xmlrpcval($sendstring, 'string');
1239 $this->assertEquals("<value><string>κόσμε</string></value>\n", $v);
1240 $GLOBALS['xmlrpc_internalencoding'] = 'ISO-8859-1';
1243 function testUTF8Response()
1245 $s = new xmlrpcmsg('dummy');
1246 $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
1247 <member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>'.utf8_encode('������').'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
1249 $r = $s->parseResponse($f, false, 'phpvals');
1252 $this->assertEquals("������", $v);
1253 $f = '<?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
1254 <member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>'.utf8_encode('������').'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
1256 $r = $s->parseResponse($f, false, 'phpvals');
1259 $this->assertEquals("������", $v);
1262 function testUTF8IntString()
1264 $v=new xmlrpcval(100, 'int');
1265 $s=$v->serialize('UTF-8');
1266 $this->assertequals("<value><int>100</int></value>\n", $s);
1269 function testStringInt()
1271 $v=new xmlrpcval('hello world', 'int');
1273 $this->assertequals("<value><int>0</int></value>\n", $s);
1276 function testStructMemExists()
1278 $v=php_xmlrpc_encode(array('hello' => 'world'));
1279 $b=$v->structmemexists('hello');
1280 $this->assertequals(true, $b);
1281 $b=$v->structmemexists('world');
1282 $this->assertequals(false, $b);
1285 function testNilvalue()
1287 // default case: we do not accept nil values received
1288 $v = new xmlrpcval('hello', 'null');
1289 $r = new xmlrpcresp($v);
1290 $s = $r->serialize();
1291 $m = new xmlrpcmsg('dummy');
1292 $r = $m->parseresponse($s);
1293 $this->assertequals(2, $r->faultCode());
1294 // enable reception of nil values
1295 $GLOBALS['xmlrpc_null_extension'] = true;
1296 $r = $m->parseresponse($s);
1298 $this->assertequals('null', $v->scalartyp());
1299 // test with the apache version: EX:NIL
1300 $GLOBALS['xmlrpc_null_apache_encoding'] = true;
1302 $v = new xmlrpcval('hello', 'null');
1303 $s = $v->serialize();
1304 $this->assertequals(1, preg_match( '#<value><ex:nil/></value>#', $s ));
1306 $r = new xmlrpcresp($v);
1307 $s = $r->serialize();
1308 $r = $m->parseresponse($s);
1310 $this->assertequals('null', $v->scalartyp());
1311 $GLOBALS['xmlrpc_null_extension'] = false;
1312 $r = $m->parseresponse($s);
1313 $this->assertequals(2, $r->faultCode());
1316 function TestLocale()
1318 $locale = setlocale(LC_NUMERIC, 0);
1319 /// @todo on php 5.3/win setting locale to german does not seem to set decimal separator to comma...
1320 if (setlocale(LC_NUMERIC,'deu', 'de_DE@euro', 'de_DE', 'de', 'ge') !== false)
1322 $v = new xmlrpcval(1.1, 'double');
1323 if (strpos($v->scalarval(), ',') == 1)
1325 $r = $v->serialize();
1326 $this->assertequals(false, strpos($r, ','));
1328 setlocale(LC_NUMERIC, $locale);
1333 class InvalidHostTests extends PHPUnit_TestCase
1339 global $DEBUG,$LOCALSERVER;
1340 $this->client=new xmlrpc_client('/NOTEXIST.php', $LOCALSERVER, 80);
1343 $this->client->setDebug($DEBUG);
1349 $f = new xmlrpcmsg('examples.echo',array(
1350 new xmlrpcval('hello', 'string')
1352 $r = $this->client->send($f, 5);
1353 $this->assertEquals(5, $r->faultCode());
1356 function testSrvNotFound()
1358 $f = new xmlrpcmsg('examples.echo',array(
1359 new xmlrpcval('hello', 'string')
1361 $this->client->server .= 'XXX';
1362 $r = $this->client->send($f, 5);
1363 $this->assertEquals(5, $r->faultCode());
1366 function testCurlKAErr()
1368 global $LOCALSERVER, $URI;
1369 if(!function_exists('curl_init'))
1371 $this->fail('CURL missing: cannot test curl keepalive errors');
1374 $f = new xmlrpcmsg('examples.stringecho',array(
1375 new xmlrpcval('hello', 'string')
1377 // test 2 calls w. keepalive: 1st time connection ko, second time ok
1378 $this->client->server .= 'XXX';
1379 $this->client->keepalive = true;
1380 $r = $this->client->send($f, 5, 'http11');
1381 // in case we have a "universal dns resolver" getting in the way, we might get a 302 instead of a 404
1382 $this->assertTrue($r->faultCode() === 8 || $r->faultCode() == 5);
1384 // now test a successful connection
1385 $server = explode(':', $LOCALSERVER);
1386 if(count($server) > 1)
1388 $this->client->port = $server[1];
1390 $this->client->server = $server[0];
1391 $this->client->path = $URI;
1393 $r = $this->client->send($f, 5, 'http11');
1394 $this->assertEquals(0, $r->faultCode());
1396 is_object( $ro ) && $this->assertEquals('hello', $ro->scalarVal());
1401 $suite->addTest(new LocalhostTests('testString'));
1402 $suite->addTest(new LocalhostTests('testAdding'));
1403 $suite->addTest(new LocalhostTests('testAddingDoubles'));
1404 $suite->addTest(new LocalhostTests('testInvalidNumber'));
1405 $suite->addTest(new LocalhostTests('testBoolean'));
1406 $suite->addTest(new LocalhostTests('testCountEntities'));
1407 $suite->addTest(new LocalhostTests('testBase64'));
1408 $suite->addTest(new LocalhostTests('testDateTime'));
1409 $suite->addTest(new LocalhostTests('testServerMulticall'));
1410 $suite->addTest(new LocalhostTests('testClientMulticall1'));
1411 $suite->addTest(new LocalhostTests('testClientMulticall2'));
1412 $suite->addTest(new LocalhostTests('testClientMulticall3'));
1413 $suite->addTest(new LocalhostTests('testCatchWarnings'));
1414 $suite->addTest(new LocalhostTests('testCatchExceptions'));
1415 $suite->addTest(new LocalhostTests('testZeroParams'));
1416 $suite->addTest(new LocalhostTests('testCodeInjectionServerSide'));
1417 $suite->addTest(new LocalhostTests('testAutoRegisteredFunction'));
1418 $suite->addTest(new LocalhostTests('testAutoRegisteredMethod'));
1419 $suite->addTest(new LocalhostTests('testSetCookies'));
1420 $suite->addTest(new LocalhostTests('testGetCookies'));
1421 $suite->addTest(new LocalhostTests('testSendTwiceSameMsg'));
1423 $suite->addTest(new LocalhostMultiTests('testUTF8Requests'));
1424 $suite->addTest(new LocalhostMultiTests('testUTF8Responses'));
1425 $suite->addTest(new LocalhostMultiTests('testISORequests'));
1426 $suite->addTest(new LocalhostMultiTests('testISOResponses'));
1427 $suite->addTest(new LocalhostMultiTests('testGzip'));
1428 $suite->addTest(new LocalhostMultiTests('testDeflate'));
1429 $suite->addTest(new LocalhostMultiTests('testProxy'));
1430 $suite->addTest(new LocalhostMultiTests('testHttp11'));
1431 $suite->addTest(new LocalhostMultiTests('testHttp11Gzip'));
1432 $suite->addTest(new LocalhostMultiTests('testHttp11Deflate'));
1433 $suite->addTest(new LocalhostMultiTests('testKeepAlives'));
1434 $suite->addTest(new LocalhostMultiTests('testHttp11Proxy'));
1435 $suite->addTest(new LocalhostMultiTests('testHttps'));
1436 $suite->addTest(new LocalhostMultiTests('testHttpsProxy'));
1438 $suite->addTest(new InvalidHostTests('test404'));
1439 //$suite->addTest(new InvalidHostTests('testSrvNotFound'));
1440 $suite->addTest(new InvalidHostTests('testCurlKAErr'));
1442 $suite->addTest(new ParsingBugsTests('testMinusOneString'));
1443 $suite->addTest(new ParsingBugsTests('testUnicodeInMemberName'));
1444 $suite->addTest(new ParsingBugsTests('testUnicodeInErrorString'));
1445 $suite->addTest(new ParsingBugsTests('testValidNumbers'));
1446 $suite->addTest(new ParsingBugsTests('testAddScalarToStruct'));
1447 $suite->addTest(new ParsingBugsTests('testAddStructToStruct'));
1448 $suite->addTest(new ParsingBugsTests('testAddArrayToArray'));
1449 $suite->addTest(new ParsingBugsTests('testEncodeArray'));
1450 $suite->addTest(new ParsingBugsTests('testEncodeRecursive'));
1451 $suite->addTest(new ParsingBugsTests('testBrokenrequests'));
1452 $suite->addTest(new ParsingBugsTests('testBrokenresponses'));
1453 $suite->addTest(new ParsingBugsTests('testBuggyHttp'));
1454 $suite->addTest(new ParsingBugsTests('testStringBug'));
1455 $suite->addTest(new ParsingBugsTests('testWhiteSpace'));
1456 $suite->addTest(new ParsingBugsTests('testAutodecodeResponse'));
1457 $suite->addTest(new ParsingBugsTests('testNoDecodeResponse'));
1458 $suite->addTest(new ParsingBugsTests('testAutoCoDec'));
1459 $suite->addTest(new ParsingBugsTests('testUTF8Response'));
1460 $suite->addTest(new ParsingBugsTests('testUTF8Request'));
1461 $suite->addTest(new ParsingBugsTests('testUTF8IntString'));
1462 $suite->addTest(new ParsingBugsTests('testStringInt'));
1463 $suite->addTest(new ParsingBugsTests('testStructMemExists'));
1464 $suite->addTest(new ParsingBugsTests('testDoubleDataInArrayTag'));
1465 $suite->addTest(new ParsingBugsTests('testDoubleStuffInValueTag'));
1466 $suite->addTest(new ParsingBugsTests('testNilValue'));
1467 $suite->addTest(new ParsingBugsTests('testLocale'));
1469 $title = 'XML-RPC Unit Tests';
1473 $suite = new PHPUnit_TestSuite($only);
1476 if(isset($_SERVER['REQUEST_METHOD']))
1478 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";
1485 if(isset($_SERVER['REQUEST_METHOD']))
1487 echo "<h3>Using lib version: $xmlrpcVersion on PHP version: ".phpversion()."</h3>\n";
1488 echo '<h3>Running '.$suite->testCount().' tests (some of which are multiple) against servers: http://'.htmlspecialchars($LOCALSERVER.$URI).' and https://'.htmlspecialchars($HTTPSSERVER.$HTTPSURI)."\n ...</h3>\n";
1494 echo "Using lib version: $xmlrpcVersion on PHP version: ".phpversion()."\n";
1495 echo 'Running '.$suite->testCount().' tests (some of which are multiple) against servers: http://'.$LOCALSERVER.$URI.' and https://'.$HTTPSSERVER.$HTTPSURI."\n\n";
1498 // do some basic timing measurement
1499 list($micro, $sec) = explode(' ', microtime());
1500 $start_time = $sec + $micro;
1502 $PHPUnit = new PHPUnit;
1503 $result = $PHPUnit->run($suite, ($DEBUG == 0 ? '.' : '<hr/>'));
1505 list($micro, $sec) = explode(' ', microtime());
1506 $end_time = $sec + $micro;
1508 if(!isset($_SERVER['REQUEST_METHOD']))
1510 echo $result->toString()."\n";
1513 if(isset($_SERVER['REQUEST_METHOD']))
1515 echo '<h3>'.$result->failureCount()." test failures</h3>\n";
1516 printf("Time spent: %.2f secs<br/>\n", $end_time - $start_time);
1520 echo $result->failureCount()." test failures\n";
1521 printf("Time spent: %.2f secs\n", $end_time - $start_time);
1524 if($result->failureCount() && !$DEBUG)
1526 $target = strpos($_SERVER['PHP_SELF'], '?') ? $_SERVER['PHP_SELF'].'&DEBUG=1' : $_SERVER['PHP_SELF'].'?DEBUG=1';
1527 $t2 = strpos($_SERVER['PHP_SELF'], '?') ? $_SERVER['PHP_SELF'].'&DEBUG=2' : $_SERVER['PHP_SELF'].'?DEBUG=2';
1528 if(isset($_SERVER['REQUEST_METHOD']))
1530 echo '<p>Run testsuite with <a href="'.$target.'">DEBUG=1</a> to have more detail about tests results. Or with <a href="'.$t2.'">DEBUG=2</a> for even more.</p>'."\n";
1534 echo "Run testsuite with DEBUG=1 (or 2) to have more detail about tests results\n";
1538 if(isset($_SERVER['REQUEST_METHOD']))
1541 <a href="#" onclick="if (document.getElementById('opts').style.display == 'block') document.getElementById('opts').style.display = 'none'; else document.getElementById('opts').style.display = 'block';">More options...</a>
1542 <div id="opts" style="display: none;">
1543 <form method="GET" style="border: 1px solid silver; margin: 5px; padding: 5px; font-family: monospace;">
1544 HTTP Server: <input name="LOCALSERVER" size="30" value="<?php echo htmlspecialchars($LOCALSERVER); ?>"/> Path: <input name="URI" size="30" value="<?php echo htmlspecialchars($URI); ?>"/><br/>
1545 HTTPS Server: <input name="HTTPSSERVER" size="30" value="<?php echo htmlspecialchars($HTTPSSERVER); ?>"/> Path: <input name="HTTPSURI" size="30" value="<?php echo htmlspecialchars($HTTPSURI); ?>"/> Do not verify cert: <input name="HTTPSIGNOREPEER" value="true" type="checkbox" <?php if ($HTTPSIGNOREPEER) echo 'checked="checked"'; ?>/><br/>
1547 Proxy Server: <input name="PROXY" size="30" value="<?php echo isset($PROXY) ? htmlspecialchars($PROXY) : ''; ?>"/> <input type="submit" value="Run Testsuite"/>
1551 echo $result->toHTML()."\n</body>\n</html>\n";
1555 exit($result->failureCount());