Home » Web Services » XML_RPC » Bug #7670
XML_RPC does not handle faults where faultCode = 0
Details
| Submitted | 2006-05-19 08:30 UTC |
|---|---|
| From | pear at asgeirnilsen dot com |
| Status | Duplicate |
| Package | XML_RPC |
| PHP Version | 4.3.2 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2006-05-19 08:30 UTC] pear at asgeirnilsen dot com
Description:
------------
For XML-RPC servers returning faults with a fault code of 0 (zero), XML_RPC does not detect the fact that it is a fault.
This is due to the XML_RPC_Response constructor's default value for fcode being zero, and the constructor test for fault existence by checking that this code != 0.
XML_RPC_Response is thus not populated with the fault information, and $response->faultCode() or $response->faultString() does not return the fault that occurred.
Any attempt to decode the response after this produces the PHP warnings.
The proposed patch below corrects this.
Test script:
---------------
--- RPC.php.orig 2006-04-25 16:19:31.000000000 +0200
+++ RPC.php 2006-05-19 10:13:49.000000000 +0200
@@ -1030,9 +1030,9 @@
/**
* @return void
*/
- function XML_RPC_Response($val, $fcode = 0, $fstr = '')
+ function XML_RPC_Response($val, $fcode = NULL, $fstr = NULL)
{
- if ($fcode != 0) {
+ if (isset($fcode)) {
$this->fn = $fcode;
$this->fs = htmlspecialchars($fstr);
} else {