undeprecate setDebug; fix one interop error; add a test for interop errors
authorgggeek <giunta.gaetano@gmail.com>
Mon, 30 Jan 2023 17:12:14 +0000 (17:12 +0000)
committergggeek <giunta.gaetano@gmail.com>
Mon, 30 Jan 2023 17:12:14 +0000 (17:12 +0000)
src/Client.php
src/Helper/Interop.php
src/Server.php
tests/07ClientTest.php

index 9c879e6..e1230fd 100644 (file)
@@ -629,7 +629,6 @@ class Client
      *
      * @param integer $level values -1, 0, 1 and 2 are supported
      * @return $this
-     * @deprecated use setOption
      */
     public function setDebug($level)
     {
index e37270c..9311576 100644 (file)
@@ -13,7 +13,7 @@ class Interop
         'invalid_return' => 2,
         'incorrect_params' => -32602,
         'introspect_unknown' => -32601, // this shares the same code but has a separate meaning from 'unknown_method'...
-        'http_error' => 32300,
+        'http_error' => -32300,
         'no_data' => -32700,
         'no_ssl' => -32400,
         'curl_fail' => -32400,
index 2c9378a..a9f35fa 100644 (file)
@@ -294,7 +294,6 @@ class Server
      *                    execution anymore, but just end up logged in the xml-rpc response)
      *                    Note that info added at level 2 and 3 will be base64 encoded
      * @return $this
-     * @deprecated use setOption
      */
     public function setDebug($level)
     {
index fe02006..07a6abd 100644 (file)
@@ -27,6 +27,18 @@ class ClientTest extends PhpXmlRpc_LoggerAwareTestCase
         $this->assertEquals(5, $r->faultCode());
     }
 
+    public function test404Interop()
+    {
+        $m = new xmlrpcmsg('examples.echo', array(
+            new xmlrpcval('hello', 'string'),
+        ));
+        $orig = \PhpXmlRpc\PhpXmlRpc::$xmlrpcerr;
+        \PhpXmlRpc\PhpXmlRpc::useInteropFaults();
+        $r = $this->client->send($m, 5);
+        $this->assertEquals(-32300, $r->faultCode());
+        \PhpXmlRpc\PhpXmlRpc::$xmlrpcerr = $orig;
+    }
+
     public function testSrvNotFound()
     {
         $m = new xmlrpcmsg('examples.echo', array(