From: gggeek Date: Wed, 18 Jan 2023 09:07:12 +0000 (+0000) Subject: fix handling of unknown methods, recently broken X-Git-Tag: 4.10.0~134 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=7162b6918dde9a6a27a2fd9ba756d22694a287a7;p=plcapi.git fix handling of unknown methods, recently broken --- diff --git a/src/Server.php b/src/Server.php index 780174de..7b8b4058 100644 --- a/src/Server.php +++ b/src/Server.php @@ -881,7 +881,7 @@ class Server if (!isset($dmap[$methodName]['function'])) { // No such method - throw new PhpXmlrpcException(0, PhpXmlRpc::$xmlrpcstr['unknown_method'], PhpXmlRpc::$xmlrpcerr['unknown_method']); + throw new PhpXmlrpcException(PhpXmlRpc::$xmlrpcstr['unknown_method'], PhpXmlRpc::$xmlrpcerr['unknown_method']); } // alter on-the-fly the config of the xml parser if needed diff --git a/tests/5ServerTest.php b/tests/5ServerTest.php index 829f19ce..ff4c320a 100644 --- a/tests/5ServerTest.php +++ b/tests/5ServerTest.php @@ -360,13 +360,18 @@ class ServerTest extends PhpXmlRpc_PolyfillTestCase new xmlrpcval("\"; exec('ls')", 'int'), )); $v = $this->send($m); - /// @todo a fault condition should be generated here - /// by the server, which we pick up on + /// @todo a specific fault should be generated here by the server, which we can check if ($v) { $this->assertEquals(0, $v->scalarval()); } } + public function testUnknownMethod() + { + $m = new xmlrpcmsg('examples.a_very_unlikely.method', array()); + $v = $this->send($m, \PhpXmlRpc\PhpXmlRpc::$xmlrpcerr['unknown_method']); + } + public function testBoolean() { $m = new xmlrpcmsg('examples.invertBooleans', array(