|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-08-17 21:46 UTC] php at virtualmonet dot com
Description:
------------
It seems PHP soap server does not set the default parameter values of the called method.
#===================================================
Line 1 should return "sayhello to x"
but instead returns "sayhello to"
Reproduce code:
---------------
#--------------------------------------------------
# on the server side
class Test1 {
/**
*
* @param string $me
* @return string
*/
function sayHello($me='x'){
$s = "sayhello to $me";
return $s;
}
}
#--------------------------------------------------
# on the client side
$o=new SoapClient($url);
echo $o->sayhello() . "<br>";
Expected result:
----------------
sayhello to x
Actual result:
--------------
sayhello to
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 20:00:01 2025 UTC |
This bug still occurs after moren than 4 years.. <?php /** * Serverside * / class Test1 { /** * * @param string $me * @return string */ function sayHello($me='x'){ $s = "sayhello to $me"; return $s; } } $soap = new Zend_Soap_Server(HOST.URL."/api.php?wsdl"); $soap->setClass('Test1'); $soap->setPersistence(SOAP_PERSISTENCE_SESSION); $soap->handle(); ?> <?php /** * Client */ $o=new SoapClient($url); echo $o->sayhello() . "<br>"; ?> Expected result: ---------------- sayhello to x Actual result: -------------- sayhello to I am wondering why this was closed. Just because of the non given "<?php ?>"?<?php /** * Serverside */ if(isset($_GET['wsdl'])) { $autodiscover = new Zend_Soap_AutoDiscover(); $autodiscover->setClass('Test1'); $autodiscover->handle(); } else { $soap = new Zend_Soap_Server(HOST.URL."/api.php?wsdl"); $soap->setClass('Test1'); $soap->setPersistence(SOAP_PERSISTENCE_SESSION); $soap->handle(); } ?> correct one, sorry for the mistake I posted. well bug still exists. Looks like SoapClient sends NULL for parameters which were not set.