php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47919 SoapServer::addClass() and/or changes to addFunction()
Submitted: 2009-04-07 15:41 UTC Modified: 2011-01-02 02:40 UTC
Votes:16
Avg. Score:4.4 ± 0.8
Reproduced:14 of 14 (100.0%)
Same Version:5 (35.7%)
Same OS:5 (35.7%)
From: e dot sand at elisand dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.2.9 OS: Irrelevant
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-04-07 15:41 UTC] e dot sand at elisand dot com
Description:
------------
It is currently impossible (so it seems) to *add* a class of functions to SoapServer for handling.  The call to setClass() or setObject() overwrite the entire exported function list, so if you wish to try and add multiple classes containing functions to the SoapServer, it is not possible.

Introducing a new addClass() (I don't think exporting multiple objects through a new addObject() call would make viable sense though) that would allow *appending* additional functions to the exported function list for SoapServer would resolve this problem.

Additionally or alternatively, addFunction() could be modified to allow accessing class functions as well.  Currently it is impossible to export any class functions to the SoapServer by using addFunction().

Reproduce code:
---------------
class SOAPMethods {
	public static function fun() {...}
}

$server = New SoapServer(...);
$server->setObject($myobject);

// this overwrites the exporting of $myobject above.
$server->setClass('SOAPMethods');

// this method also doesn't work (should, as of PHP5.2.3)
$server->addFunction('SOAPMethods::setQuantity');

// neither does this syntax for accessing class functions
$server->addFunction(array('SOAPMethods', 'setQuantity'));

// neither does this syntax for accessing class functions
$methods = new SOAPMethods;
$server->addFunction(array(&$methods, 'setQuantity'));


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-07 15:45 UTC] e dot sand at elisand dot com
Apologies for the possible confusion in an obvious typo in the code examples - I used "setQuantity" instead of my example function named "fun").  The actual example code should be:

class SOAPMethods {
	public static function fun() {...}
}

$server = New SoapServer(...);
$server->setObject($myobject);

// this overwrites the exporting of $myobject above.
$server->setClass('SOAPMethods');

// this method also doesn't work (should, as of PHP5.2.3)
$server->addFunction('SOAPMethods::fun');

// neither does this syntax for accessing class functions
$server->addFunction(array('SOAPMethods', 'fun'));

// neither does this syntax for accessing class functions
$methods = new SOAPMethods;
$server->addFunction(array(&$methods, 'fun'));
 [2011-01-02 02:40 UTC] jani@php.net
-Package: Feature/Change Request +Package: SOAP related
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 10:02:10 2014 UTC