Home » Web Services » XML_RPC » Bug #8764
Wrong decoding of xmlrpc-boolean
Details
| Submitted | 2006-09-22 09:05 UTC |
|---|---|
| From | jj at learnbit dot com |
| Assigned | danielc |
| Status | Wont fix |
| Package | XML_RPC |
| PHP Version | 5.1.4 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2006-09-22 09:05 UTC] jj at learnbit dot com
Description:
------------
A response which contains a boolean isn't parsed correctly be the xmlrpc-client. It matches all xmlrpc-boolean-values to php-ints (0 or 1).
[...]
$responseValue = XML_RPC_decode($response->value());
if ($responseValue === true) {
echo "yihaaa response ist true";
}
The output won't occur, because $responseValue is always an int.
Test script:
---------------
<?php
require_once 'XML/RPC.php';
$msg = new XML_RPC_Message ("");
$resp = $msg->parseResponse("HTTP/1.1 200 OK
Date: Fri, 22 Sep 2006 08:53:14 GMT
Server: Apache
X-Powered-By: PHP/5.1.4-pl4-gentoo
Content-Length: 145
Connection: close
Content-Type: text/xml; charset=UTF-8
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<methodResponse>
<params>
<param>
<value><boolean>1</boolean></value>
</param>
</params>
</methodResponse>");
var_dump(XML_RPC_decode($resp->value()));
?>
<value><boolean>1</boolean></value>
</param>
</params>
</methodResponse>");
var_dump(XML_RPC_decode($resp->value()));
?>
Expected result:
----------------
bool(true)
Actual result:
--------------
int(1)
[2006-10-30 09:25 UTC] hp at learnbit dot com
I can reproduce this problem as well, so I wonder why you have flagged this bug as "won't fix". Could you please give a short comment on why you believe this bug is not worth fixing it?