php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #62582 xmlrpc_server_* should handle exceptions
Submitted: 2012-07-16 21:16 UTC Modified: 2012-07-24 20:16 UTC
From: gmblar+php at gmail dot com Assigned:
Status: Open Package: XMLRPC-EPI related
PHP Version: 5.4.4 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gmblar+php at gmail dot com
New email:
PHP Version: OS:

 

 [2012-07-16 21:16 UTC] gmblar+php at gmail dot com
Description:
------------
xmlrpc_server_* should handle exceptions and return a xmlrpc fault

Test script:
---------------
<?php

$xmlrpc = xmlrpc_server_create();
xmlrpc_server_register_method($xmlrpc, 'foo.bar', function() {
    throw new Exception('foobar', 42);
});

$request = xmlrpc_encode_request('foo.bar', array());
$result = xmlrpc_server_call_method($xmlrpc, $request, array());
echo $result;


Expected result:
----------------
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<fault>
 <value>
  <struct>
   <member>
    <name>faultString</name>
    <value>
     <string>foobar</string>
    </value>
   </member>
   <member>
    <name>faultCode</name>
    <value>
     <int>42</int>
    </value>
   </member>
  </struct>
 </value>
</fault>
</methodResponse>


Actual result:
--------------
Fatal error: Uncaught exception 'Exception' with message 'foobar' in -:5
Stack trace:
#0 [internal function]: {closure}('foo.bar', Array, Array)
#1 -(9): xmlrpc_server_call_method(Resource id #1, '<?xml version="...', Array)
#2 {main}
  thrown in - on line 5

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-24 20:16 UTC] gmblar+php at gmail dot com
-Package: *XML functions +Package: XMLRPC-EPI related
 [2012-07-24 20:16 UTC] gmblar+php at gmail dot com
Change package
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 22:01:25 2019 UTC