Req #62582 [NEW]: xmlrpc_server_* should handle exceptions

From: Date: Mon, 16 Jul 2012 21:16:06 +0000
Subject: Req #62582 [NEW]: xmlrpc_server_* should handle exceptions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-172018@lists.php.net to get a copy of this message
From:             gmblar+php at gmail dot com
Operating system: 
PHP version:      5.4.4
Package:          *XML functions
Bug Type:         Feature/Change Request
Bug description:xmlrpc_server_* should handle exceptions

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

-- 
Edit bug report at https://bugs.php.net/bug.php?id=62582&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=62582&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=62582&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=62582&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=62582&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62582&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=62582&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=62582&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=62582&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=62582&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=62582&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=62582&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=62582&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=62582&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=62582&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=62582&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62582&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=62582&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=62582&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=62582&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=62582&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=62582&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#172018) next »