PEAR is archived and read-only

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

Home » Web Services » SOAP » Bug #3048

Parse Error: using methodname 'echo' conflicts PHP keyword.

Details

Submitted2004-12-29 02:20 UTC
Fromwatanabe at netsolutions dot ne dot jp
Assignedyunosh
StatusClosed
PackageSOAP
PHP Version4.3.10
OSWindowsXP
Roadmaps(Not assigned)

Comments

[2004-12-29 02:20 UTC] watanabe at netsolutions dot ne dot jp

Description:
------------
I made one Web Service which has a method 'echo'.
And when tried to call from PEAR::SOAP, parse error occured at getProxy() code.

>PHP Parse error: parse error, expecting `T_STRING' in >c:\php4\PEAR\SOAP\WSDL.php(619) : eval()'d code on line 7

I checked proxy code and found 'echo' method name is the problem.

This time I changed method name.
However, this proxy generating mechanism may be dengerous,
as there should be many Web services inculuding PHP keywords.

Reproduce code:
---------------
// EchoMessage service receives 'foo' and return "your message=foo"

require_once('SOAP/Client.php');
$wsdl_url = 'http://axiserver:8080/axis/services/EchoMessage?wsdl';
$WSDL = new SOAP_WSDL($wsdl_url);
//echo ( $WSDL->generateProxyCode());
$client= $WSDL->getProxy();

// $body = $WSDL->echo('foo');

Expected result:
----------------
generated proxy code which works.

Actual result:
--------------
PHP Parse error: parse error, expecting `T_STRING' in c:\php4\PEAR\SOAP\WSDL.php(619) : eval()'d code on line 7

eval()'ed code as follows:
-------------------------------------------------
class WebService_EchoMessageService_EchoMessage extends SOAP_Client
{
function WebService_EchoMessageService_EchoMessage()
{
$this->SOAP_Client("http://tdb1:8080/axis/services/EchoMessage", 0);
}
function &echo($message) {
return $this->call("echo",
$v = array("message"=>$message),
array('namespace'=>'http://echomessage',
'soapaction'=>'',
'style'=>'rpc',
'use'=>'encoded' ));
}
}
------------------------------
>function &echo($message)
this seems problem point.

[2005-02-22 10:34 UTC] smith at backendmedia dot com

the call to eval() should probably be silenced and proper PEAR error handling should be introduced.

[2006-01-02 04:27 UTC] kei at mars dot dti dot ne dot jp

(I am first poster watanabe at netsolutions. Now changed job :) )

I read Smarty source code.
It seems generating some hash code and adding to every function names during object registration.
Can it be used?