Bug #55567 [Com]: SoapFault is missing methods to get the Fault Code
| From: | hairmare at purplehaze dot ch | Date: | Thu, 08 Dec 2011 16:41:14 +0000 |
| Subject: | Bug #55567 [Com]: SoapFault is missing methods to get the Fault Code | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165747@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55567&edit=1
ID: 55567
Comment by: hairmare at purplehaze dot ch
Reported by: ch@php.net
Summary: SoapFault is missing methods to get the Fault Code
Status: Open
Type: Bug
Package: SOAP related
PHP Version: 5.4.0alpha3
Block user comment: N
Private report: N
New Comment:
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--
Test for strings in Exception::getCode()
--FILE--
<?php
$e = new SOAPFault("Client", "Sample Error Message");
var_dump($e->getCode());
?>
--EXPECT--
string(6) "Client"
Previous Comments:
------------------------------------------------------------------------
[2011-09-01 17:15:35] ch@php.net
Description:
------------
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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55567&edit=1