PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Web Services » XML_RPC » Bug #7819

Wrong Reponse on '-1' -String

Details

Doc Bug #7819Wrong Reponse on '-1' -String
Submitted2006-06-06 08:36 UTC
Frommra at deltaz dot com
Assignedcweiske
StatusClosed
PackageXML_RPC
PHP VersionIrrelevant
OSwin and linux
Roadmaps(Not assigned)

Comments

[2006-06-06 08:36 UTC] mra at deltaz dot com

Description:
------------
If you pass a string containing "-1" do XML_RPC_Value constructor without a type (this means string as default type) the response is empty, but should contain the "-1" string in the result.

Test script:
---------------
require_once 'XML/RPC/Server.php';

//with some good and bad cases
function foobar($params) {
// (1) Doesn't work fine
$obj = new XML_RPC_Value('-1');
// (2) Doesn't work fine
// $obj = new XML_RPC_Value((string) '-1');
// (3) Work's fine
// $obj = new XML_RPC_Value('-1', 'string');
// (4) Even this works fine "-2" as string
// $obj = new XML_RPC_Value('-2');
return new XML_RPC_Response($obj);
}

$server = new XML_RPC_Server(
array(
'foobar' => array(
'function' => 'foobar')
),
0, // service not now
1 // Debug 1=on
);

if (empty($HTTP_RAW_POST_DATA)) {
echo "empty";
} else {
$server->service();
}

Expected result:
----------------
<methodResponse>
<params>
<param>
<value><string>-1</string></value>
</param>
</params>
</methodResponse>

-->produced with (3), looks good

Actual result:
--------------
<methodResponse>
<params>
<param>
</param>
</params>
</methodResponse>

-->produced with (1)
-->So empty payload as result