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:23
Avg. Score:4.4 ± 0.8
Reproduced:21 of 21 (100.0%)
Same Version:6 (28.6%)
Same OS:7 (33.3%)
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: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: e dot sand at elisand dot com
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 16:01:30 2024 UTC