From: ggiunta Date: Fri, 31 Jul 2009 23:35:33 +0000 (+0000) Subject: - benchmark.php: fixed url of server page used for testing; improved verification... X-Git-Tag: 3.0.0-beta~16 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=322fe8c316efdb0e5844898f439bbb0cfdc52fb3 - benchmark.php: fixed url of server page used for testing; improved verification of correspondence of test results; added more variants for http options comparison; - verify_compat.php: check for php version 5 for client side too; - makefile: remove from build the compat directory git-svn-id: https://svn.code.sf.net/p/phpxmlrpc/code/trunk/xmlrpc@37 013ecfd8-0664-425d-a759-9c98391dc3f9 --- diff --git a/ChangeLog b/ChangeLog index 706f959..8b19297 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,14 @@ * benchmark.php, xmlrpc_wrappers.inc: remove usage of split(), deprecated in php 5.3 + * benchmark.php: fixed url of server page used for testing; improved + verification of correspondence of test results; added more variants for + http options comparison + + * verify_compat.php: check for php version 5 for client side too + + * makefile: remove from build the compat directory + 2009-07-26 - G. Giunta (giunta.gaetano@gmail.com) * server.php: remove usage of ereg*(), deprecated in php 5.3 diff --git a/Makefile b/Makefile index 8e42dac..4b4171f 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ FIND=find # 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 ) -LIBFILES=lib/xmlrpc.inc lib/xmlrpcs.inc lib/xmlrpc_wrappers.inc lib/compat/*.php +LIBFILES=lib/xmlrpc.inc lib/xmlrpcs.inc lib/xmlrpc_wrappers.inc EXTRAFILES=extras/test.pl \ extras/test.py \ @@ -98,7 +98,6 @@ xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz: ${LIBFILES} ${DEBUGGERFILES} ${I ${MKDIR} xmlrpc-${VERSION}/test/PHPUnit ${MKDIR} xmlrpc-${VERSION}/extras ${MKDIR} xmlrpc-${VERSION}/lib - ${MKDIR} xmlrpc-${VERSION}/lib/compat ${MKDIR} xmlrpc-${VERSION}/debugger cp --parents ${DEMOFILES} xmlrpc-${VERSION} cp --parents ${DEMOCFILES} xmlrpc-${VERSION} diff --git a/NEWS b/NEWS index 0f1673c..5d8ca48 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ XML-RPC for PHP version 2.2.2 - 2009/03/16 This release corrects all bugs that have been reported and sucesfully reproduced since version 2.2.1. -Regardless of the intimitading message about dropping PHP 4 support, it still does +Regardless of the intimidating message about dropping PHP 4 support, it still does support that ancient, broken and insecure platform. * fixed: php warning when receiving 'false' in a bool value diff --git a/debugger/action.php b/debugger/action.php index 081340b..2b70e2c 100644 --- a/debugger/action.php +++ b/debugger/action.php @@ -81,7 +81,7 @@ td form {margin: 0;} $server = 'http://'.$server; } if ($proxy != '') { - $pproxy = split(':', $proxy); + $pproxy = explode(':', $proxy); if (count($pproxy) > 1) $pport = $pproxy[1]; else diff --git a/test/benchmark.php b/test/benchmark.php index 0238ce0..f320146 100644 --- a/test/benchmark.php +++ b/test/benchmark.php @@ -5,8 +5,10 @@ * @version $Id$ * @copyright (c) 2005-2009 G. Giunta * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt + * + * @todo add a test for response ok in call testing? **/ - +ini_set('max_execution_time', 300); include(getcwd().'/parse_args.php'); require_once('xmlrpc.inc'); @@ -40,6 +42,7 @@ echo "

Using lib version: $xmlrpcVersion on PHP version: ".phpversion()."

\n"; if ($xd) echo "

XDEBUG profiling enabled: skipping remote tests. Trace file is: ".htmlspecialchars(xdebug_get_profiler_filename())."

\n"; flush(); + ob_flush(); } else { @@ -63,7 +66,7 @@ $values[] = new xmlrpcval($val[2], 'string'); $values[] = new xmlrpcval($val[3], 'boolean'); $values[] = new xmlrpcval($val[4], 'dateTime.iso8601'); - $values[] = new xmlrpcval($val[5], 'i4'); + $values[] = new xmlrpcval($val[5], 'int'); $values[] = new xmlrpcval($val[6], 'double'); $values[] = new xmlrpcval($val[7], 'string'); $values[] = new xmlrpcval($val[8], 'boolean'); @@ -152,7 +155,7 @@ if (!$xd) { /// test multicall vs. many calls vs. keep-alives - $value = php_xmlrpc_encode($data1); + $value = php_xmlrpc_encode($data1, array('auto_dates')); $msg = new xmlrpcmsg('interopEchoTests.echoValue', array($value)); $msgs=array(); for ($i = 0; $i < 25; $i++) @@ -206,6 +209,10 @@ 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')) @@ -221,6 +228,36 @@ $response[] = $resp->value(); } end_test('Repeated send (small array)', 'http 10 w. compression', $response); + + if (function_exists('curl_init')) + { + begin_test('Repeated send (small array)', 'http 11 w. keep-alive and compression'); + $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 and compression', $response); + + $c->keepalive = false; + begin_test('Repeated send (small array)', 'http 11 w. compression'); + $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. compression', $response); + } + + begin_test('Repeated send (small array)', 'multicall w. compression'); + $response =& $c->send($msgs); + foreach ($response as $key =>& $val) + { + $val = $val->value(); + } + end_test('Repeated send (small array)', 'multicall w. compression', $response); } } // end of 'if no xdebug profiling' @@ -231,20 +268,20 @@ if (!isset($test_results[$test_name])) $test_results[$test_name]=array(); $test_results[$test_name][$test_case] = array(); - list($micro, $sec) = explode(' ', microtime()); - $test_results[$test_name][$test_case]['time'] = $sec + $micro; + $test_results[$test_name][$test_case]['time'] = microtime(true); } function end_test($test_name, $test_case, $test_result) { global $test_results; - list($micro, $sec) = explode(' ', microtime()); + $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'] = $sec + $micro - $test_results[$test_name][$test_case]['time']; + $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(); } diff --git a/test/parse_args.php b/test/parse_args.php index 5b5c8fb..39549ce 100644 --- a/test/parse_args.php +++ b/test/parse_args.php @@ -106,14 +106,14 @@ { $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', '/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', '/server.php', $URI); + $URI = str_replace('/test/benchmark.php', '/demo/server/server.php', $URI); $URI = str_replace('/benchmark.php', '/server.php', $URI); } else @@ -129,4 +129,4 @@ { $LOCALPATH = dirname(__FILE__); } -?> +?> \ No newline at end of file diff --git a/test/verify_compat.php b/test/verify_compat.php index 77553c2..ad9e6f9 100644 --- a/test/verify_compat.php +++ b/test/verify_compat.php @@ -6,19 +6,10 @@ * @author Gaetano Giunta * @copyright (C) 2006-2009 G. Giunta * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt + * + * @todo add a test for php output buffering? */ -// be backward compat up to version 4.0.5... -if (!function_exists('version_compare')) -{ - // give an opportunity to user to specify where to include other files from - if(!defined('PHP_XMLRPC_COMPAT_DIR')) - { - define('PHP_XMLRPC_COMPAT_DIR',dirname(__FILE__).'/compat/'); - } - include(PHP_XMLRPC_COMPAT_DIR.'version_compare.php'); -} - function phpxmlrpc_verify_compat($mode='client') { $tests = array(); @@ -58,7 +49,7 @@ function phpxmlrpc_verify_compat($mode='client') $tests['zlib']['description'] = "The zlib extension is enabled.\n\nYou will be able to receive compressed requests and send compressed responses for the 'HTTP' protocol"; } - // test for diaply of php errors in xml reponse + // test for dispaly of php errors in xml reponse if (ini_get('display_errors')) { if (intval(ini_get('error_reporting')) && E_NOTICE ) @@ -81,15 +72,10 @@ function phpxmlrpc_verify_compat($mode='client') $ver = phpversion(); $tests['php_version'] = array(); $tests['php_version']['description'] = 'PHP version found: '.$ver.".\n\n"; - if (version_compare($ver, '4') < 0) + if (version_compare($ver, '5') < 0) { $tests['php_version']['status'] = 0; - $tests['php_version']['description'] .= 'This version of PHP is not compatible with the PHP XMLRPC library. Please upgrade to 4.2 or later'; - } - else if (version_compare($ver, '4.2') < 0) - { - $tests['php_version']['status'] = 1; - $tests['php_version']['description'] .= "This version of PHP is partially compatible with the PHP XMLRPC library.\nIn order to use the library, you will need to make sure the files from the compat directory are available on your server"; + $tests['php_version']['description'] .= 'This version of PHP is not compatible with the PHP XMLRPC library. Please upgrade to 5.0 or later'; } else {