PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Web Services » XML_RPC » Bug #1197

use of $this outside class

Details

Submitted2004-04-13 15:00 UTC
Fromivan dot longhi at rcm dot inet dot it
Assignedpajoye
StatusClosed
PackageXML_RPC
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2004-04-13 15:00 UTC] ivan dot longhi at rcm dot inet dot it

Description:
------------
on line 273 of script RPC.php, in global function XML_RPC_ee there is a call to $this->raiseError (outside a class). When a client pass to a server a non-int value but identified as INT the server causes a PHP fatal error (Call to a member function on a non-object in /usr/local/lib/php/XML/RPC.php on line 273).

Reproduce code:
---------------
require_once("XML/RPC.php");
$myStruct = new XML_RPC_Value("NOT_INT", "int");
$client = new XML_RPC_Client("/server.php", "localhost", 80);
$client->setDebug(1);
$msg = new XML_RPC_Message("examples.myFunc", array($myStruct));
$resp = $client->send($msg);
if($resp->faultCode()) { echo "ERROR: ".$resp->faultCode()." - ".$resp->faultString(); }
else { $xmlrpc_id = $resp->value(); echo $xmlrpc_id->serialize(); }

Expected result:
----------------
the server code is the same you provide as example in XML_RPC documentation, and server signature (referring to example) is:
$findstate_sig = array(array("string", "int"));

if in php.ini I set dipsplay_errors, then....

Actual result:
--------------
---GOT---
HTTP/1.1 200 OK
Date: Tue, 13 Apr 2004 15:05:14 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.5
X-Powered-By: PHP/4.3.5
Connection: close
Content-Type: text/html

<br />
<b>Fatal error</b>: Call to a member function on a non-object in <b>/usr/local/lib/php/XML/RPC.php</b> on line <b>273</b><br />

---END---

ERROR: 2 - Invalid return payload: enabling debugging to examine incoming payload

[2004-05-31 17:35 UTC] pierre at dotgeek dot org

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.