Fix testsuite failure for https mode
authorgggeek <giunta.gaetano@gmail.com>
Mon, 8 Dec 2014 00:11:46 +0000 (00:11 +0000)
committergggeek <giunta.gaetano@gmail.com>
Mon, 8 Dec 2014 00:11:46 +0000 (00:11 +0000)
lib/xmlrpc_wrappers.inc
test/testsuite.php

index 1fbf5ce..b2c6611 100644 (file)
        * Given an xmlrpc client and a method name, register a php wrapper function\r
        * that will call it and return results using native php types for both\r
        * params and results. The generated php function will return an xmlrpcresp\r
-       * oject for failed xmlrpc calls\r
+       * object for failed xmlrpc calls\r
        *\r
        * Known limitations:\r
        * - server must support system.methodsignature for the wanted xmlrpc method\r
        * - for methods that expose many signatures, only one can be picked (we\r
-       *   could in priciple check if signatures differ only by number of params\r
+       *   could in principle check if signatures differ only by number of params\r
        *   and not by type, but it would be more complication than we can spare time)\r
        * - nested xmlrpc params: the caller of the generated php function has to\r
        *   encode on its own the params passed to the php function if these are structs\r
        *\r
        * @param xmlrpc_client $client     an xmlrpc client set up correctly to communicate with target server\r
        * @param string        $methodname the xmlrpc method to be mapped to a php function\r
-       * @param array         $extra_options array of options that specify conversion details. valid ptions include\r
+       * @param array         $extra_options array of options that specify conversion details. valid options include\r
        *        integer       signum      the index of the method signature to use in mapping (if method exposes many sigs)\r
        *        integer       timeout     timeout (in secs) to be used when executing function/calling remote method\r
        *        string        protocol    'http' (default), 'http11' or 'https'\r
-       *        string        new_function_name the name of php function to create. If unsepcified, lib will pick an appropriate name\r
+       *        string        new_function_name the name of php function to create. If unspecified, lib will pick an appropriate name\r
        *        string        return_source if true return php code w. function definition instead fo function name\r
        *        bool          encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects\r
        *        bool          decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers ---\r
 \r
                $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false;\r
                $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false;\r
+               // it seems like the meaning of 'simple_client_copy' here is swapped wrt client_copy_mode later on...\r
                $simple_client_copy = isset($extra_options['simple_client_copy']) ? (int)($extra_options['simple_client_copy']) : 0;\r
                $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true;\r
                $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc';\r
index 3b33f80..4640dae 100644 (file)
@@ -534,7 +534,8 @@ And turned it into nylon';
 
     function testAutoRegisteredMethod()
     {
-        $func=wrap_xmlrpc_method($this->client, 'examples.getStateName');
+        // make a 'deep client copy' as the original one might have many properties set
+        $func=wrap_xmlrpc_method($this->client, 'examples.getStateName', array('simple_client_copy' => 1));
         if($func == '')
         {
             $this->fail('Registration of examples.getStateName failed');
@@ -542,6 +543,11 @@ And turned it into nylon';
         else
         {
             $v=$func(23);
+            // work around bug in current version of phpunit
+            if(is_object($v))
+            {
+                $v = var_export($v, true);
+            }
             $this->assertEquals('Michigan', $v);
         }
     }
@@ -638,7 +644,9 @@ class LocalHostMultiTests extends LocalhostTests
             if(strpos($meth, 'test') === 0 && $meth != 'testHttps' && $meth != 'testCatchExceptions')
             {
                 if (!isset($failed_tests[$meth]))
+                {
                     $this->$meth();
+                }
             }
             if ($this->_failed)
             {
@@ -777,6 +785,8 @@ class LocalHostMultiTests extends LocalhostTests
         $this->client->method = 'https';
         $this->client->path = $HTTPSURI;
         $this->client->setSSLVerifyPeer( !$HTTPSIGNOREPEER );
+        // silence warning with newish php versions
+        $this->client->setSSLVerifyHost(2);
         $this->_runtests();
     }