- benchmark.php: fixed url of server page used for testing; improved verification...
authorggiunta <ggiunta@013ecfd8-0664-425d-a759-9c98391dc3f9>
Fri, 31 Jul 2009 23:35:33 +0000 (23:35 +0000)
committerggiunta <ggiunta@013ecfd8-0664-425d-a759-9c98391dc3f9>
Fri, 31 Jul 2009 23:35:33 +0000 (23:35 +0000)
- 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

ChangeLog
Makefile
NEWS
debugger/action.php
test/benchmark.php
test/parse_args.php
test/verify_compat.php

index 706f959..8b19297 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,14 @@
        * benchmark.php, xmlrpc_wrappers.inc: remove usage of split(), deprecated in\r
        php 5.3\r
 \r
+       * benchmark.php: fixed url of server page used for testing; improved\r
+       verification of correspondence of test results; added more variants for\r
+       http options comparison\r
+\r
+       * verify_compat.php: check for php version 5 for client side too\r
+\r
+       * makefile: remove from build the compat directory\r
+\r
 2009-07-26 - G. Giunta (giunta.gaetano@gmail.com)\r
 \r
        * server.php: remove usage of ereg*(), deprecated in php 5.3\r
index 8e42dac..4b4171f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ FIND=find
 #   on unix shells lasts char should be \\2/g )\r
 export VERSION=$(shell egrep "\$GLOBALS *\[ *'xmlrpcVersion' *\] *= *'" lib/xmlrpc.inc | sed -r s/"(.*= *' *)([0-9a-zA-Z.-]+)(.*)"/\2/g )\r
 \r
-LIBFILES=lib/xmlrpc.inc lib/xmlrpcs.inc lib/xmlrpc_wrappers.inc lib/compat/*.php\r
+LIBFILES=lib/xmlrpc.inc lib/xmlrpcs.inc lib/xmlrpc_wrappers.inc\r
 \r
 EXTRAFILES=extras/test.pl \\r
  extras/test.py \\r
@@ -98,7 +98,6 @@ xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz: ${LIBFILES} ${DEBUGGERFILES} ${I
        ${MKDIR} xmlrpc-${VERSION}/test/PHPUnit\r
        ${MKDIR} xmlrpc-${VERSION}/extras\r
        ${MKDIR} xmlrpc-${VERSION}/lib\r
-       ${MKDIR} xmlrpc-${VERSION}/lib/compat\r
        ${MKDIR} xmlrpc-${VERSION}/debugger\r
        cp --parents ${DEMOFILES} xmlrpc-${VERSION}\r
        cp --parents ${DEMOCFILES} xmlrpc-${VERSION}\r
diff --git a/NEWS b/NEWS
index 0f1673c..5d8ca48 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,7 @@ XML-RPC for PHP version 2.2.2 - 2009/03/16
 \r
 This release corrects all bugs that have been reported and sucesfully reproduced since\r
 version 2.2.1.\r
-Regardless of the intimitading message about dropping PHP 4 support, it still does\r
+Regardless of the intimidating message about dropping PHP 4 support, it still does\r
 support that ancient, broken and insecure platform.\r
 \r
 * fixed: php warning when receiving 'false' in a bool value\r
index 081340b..2b70e2c 100644 (file)
@@ -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
index 0238ce0..f320146 100644 (file)
@@ -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 "<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
        {
@@ -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');
        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++)
 
        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'))
                        $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'
                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();
        }
 
 
index 5b5c8fb..39549ce 100644 (file)
                {
                        $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
        {
                $LOCALPATH = dirname(__FILE__);
        }
-?>
+?>
\ No newline at end of file
index 77553c2..ad9e6f9 100644 (file)
@@ -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
     {