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 » SOAP » Bug #6625

Bad Proxy generation.

Details

Submitted2006-01-30 00:21 UTC
Fromariel dot viera at gmail dot com
Assignedyunosh
StatusBogus
PackageSOAP
PHP Version5.0.0
OSWindows
Roadmaps(Not assigned)

Comments

[2006-01-30 00:21 UTC] ariel dot viera at gmail dot com

Description:
------------
On line 673 and 680 in the file WSDL.php when the generic proxy method is defined between double quotes and appended to the generated class, PHP will try erroneously to expand "$result", when the actual purpose is to include it unexpanded. To fix it, I just prepend a backslash \ to the "$result", then becoming a "\$result", so PHP won't try to expand it.

The buggy code segment is this
-------Listing Begin-------
$class .= " function &$opname_php($args)\n {\n$comments$wrappers" .
" $result = \$this->call('$opname',\n" .
" \$v = $argarray,\n" .
" array('namespace' => '$namespace',\n" .
" 'soapaction' => '$soapaction',\n" .
" 'style' => '$opstyle',\n" .
" 'use' => '$use'" .
($this->trace?",\n 'trace' => 1" : '') . "));\n" .
" return $result;\n" .
" }\n";

-------Listing Ends-------

The Fixed Code is as follows

-------Listing Begin-------
$class .= " function &$opname_php($args)\n {\n$comments$wrappers" .
" \$result = \$this->call('$opname',\n" .
" \$v = $argarray,\n" .
" array('namespace' => '$namespace',\n" .
" 'soapaction' => '$soapaction',\n" .
" 'style' => '$opstyle',\n" .
" 'use' => '$use'" .
($this->trace?",\n 'trace' => 1" : '') . "));\n" .
" return \$result;\n" .
" }\n";
-------Listing Begin-------

Note the Backslash prepended...

Test script:
---------------
c:\>php genproxy.php http://localhost/soap/example/server.php?wsdl

Expected result:
----------------
<?php

require_once 'SOAP/Client.php';

class WebService_ITestservice_itestPort extends SOAP_Client
{
function WebService_ITestservice_itestPort($path = 'http://localhost/tests/p
roject1.cgi/soap/itest')
{
$this->SOAP_Client($path, 0);
}
function &AppendA($letter)
{
$result = $this->call('AppendA',
$v = array('letter' => $letter),
array('namespace' => 'urn:TestIntf-ITest',
'soapaction' => 'urn:TestIntf-ITest#AppendA',
'style' => 'rpc',
'use' => 'encoded'));
return $result;
}
}

?>

Actual result:
--------------
<?php

require_once 'SOAP/Client.php';

PHP Notice: Undefined variable: result in c:\AppServ\php\PEAR\SOAP\WSDL.php on
line 673

Notice: Undefined variable: result in c:\AppServ\php\PEAR\SOAP\WSDL.php on line
673

PHP Notice: Undefined variable: result in c:\AppServ\php\PEAR\SOAP\WSDL.php on
line 680

Notice: Undefined variable: result in c:\AppServ\php\PEAR\SOAP\WSDL.php on line
680

class WebService_ITestservice_itestPort extends SOAP_Client
{
function WebService_ITestservice_itestPort($path = 'http://localhost/tests/p
roject1.cgi/soap/itest')
{
$this->SOAP_Client($path, 0);
}
function &AppendA($letter)
{
= $this->call('AppendA',
$v = array('letter' => $letter),
array('namespace' => 'urn:TestIntf-ITest',
'soapaction' => 'urn:TestIntf-ITest#AppendA',
'style' => 'rpc',
'use' => 'encoded'));
return ;
}
}

?>