php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34178 SOAP Server does not honor a method default parameter value.
Submitted: 2005-08-17 21:46 UTC Modified: 2005-08-25 01:00 UTC
Votes:9
Avg. Score:4.7 ± 0.5
Reproduced:8 of 8 (100.0%)
Same Version:1 (12.5%)
Same OS:1 (12.5%)
From: php at virtualmonet dot com Assigned:
Status: No Feedback Package: SOAP related
PHP Version: 5.1.0b3 OS: redhat
Private report: No CVE-ID: None
 [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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-17 21:47 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2005-08-25 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-02-03 12:33 UTC] ab at crossconcept dot de
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 ?>"?
 [2010-02-03 12:39 UTC] ab at crossconcept dot de
<?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.
 [2010-02-03 15:53 UTC] lists at andyfowler dot com
I can confirm ab at crossconcept's report.

The bug has nothing to do with SoapServer but is in WSDL-mode 
SoapClient, which sets NULL for parameters which have not been 
specified. Should this be resubmitted with a proper subject?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 18:01:28 2024 UTC