|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55567 SoapFault is missing methods to get the Fault Code
Submitted: 2011-09-01 17:15 UTC Modified: -
Avg. Score:3.9 ± 1.1
Reproduced:9 of 9 (100.0%)
Same Version:1 (11.1%)
Same OS:2 (22.2%)
From: Assigned:
Status: Open Package: SOAP related
PHP Version: 5.4.0alpha3 OS:
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.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2011-09-01 17:15 UTC]
The SoapFault object does not have a getFaultCode() method nor does it set the exception code to the received SOAP fault code.

The code is available through the undocumented public property "faultcode" though.

I would suggest setting the Exception code to the SOAP fault code.
Backwards compatibility shouldn't be a big problem because currently, the code can only be 0 as the constructor does not even makes it possible to change it.

If you disagree, I'd like to see a getFaultCode() method at least.

Having access to the SOAP fault code is essential as SOAP does not transfer the Exception class name and thus there is no other way to cleanly distinguish between different kinds of exceptions.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-08 16:41 UTC] hairmare at purplehaze dot ch
I just ran into this in 5.3.8. Personally i would expect SOAPFault::getCode() to return the fault exactly as it was received from SOAP (ie. as a string).

I wrote a phpt case showing what behaviour I would expect. I didn't find a way to add it to this ticket, so here goes:

Test for strings in Exception::getCode()
$e = new SOAPFault("Client", "Sample Error Message");
string(6) "Client"
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 02:01:31 2024 UTC