#46792 [Bgs]: SoapFault detail property missing
| From: | daniel dot oconnor at gmail dot com | Date: | Sat, 25 Apr 2009 17:42:57 +0000 |
| Subject: | #46792 [Bgs]: SoapFault detail property missing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-136317@lists.php.net to get a copy of this message | ||
ID: 46792
User updated by: daniel dot oconnor at gmail dot com
Reported By: daniel dot oconnor at gmail dot com
Status: Bogus
Bug Type: SOAP related
Operating System: Windows
PHP Version: 5.2.7
Assigned To: dmitry
New Comment:
I still feel it should be defined all of the time, and just set to null
if there's nothing there; like every other object in PHP.
As a normal developer, I shouldn't have to remember that if I want to
check my soapfault detail I have to wrap it in isset(), because this is
one of the few niche bits of PHP which break convention.
This bug exposes two seperate problems - class definition and how that
object is rendered.
My problem is with the class definition/instatiation not fitting with
how every other class I know of behaves.
For your problems, with rendering/encoding soapfault detail needlessly,
why not just check if the property is null or not in the encoding step?
And if its that big of a concern, what about spinning of another ticket
to specifically deal with that?
Previous Comments:
------------------------------------------------------------------------
[2009-04-25 16:20:10] jani@php.net
As Dmitry said. Use isset().
------------------------------------------------------------------------
[2009-01-11 10:56:45] daniel dot oconnor at gmail dot com
Not having the property defined was surprising, and unexpected - I
would not expect code which reads SoapFault::$detail to ever generate an
E_NOTICE.
------------------------------------------------------------------------
[2009-01-11 09:40:03] dmitry@php.net
I don't think we should create empty "detail" property (and then encode
it and send back to client) if it's not important. Very rare script
looks into fault details. In case your script really needs it, it can
always check it with isset() or empty().
------------------------------------------------------------------------
[2008-12-31 17:39:13] felipe@php.net
Hi Dmitry, any objection?
http://felipe.ath.cx/diff/bug46792.diff
------------------------------------------------------------------------
[2008-12-08 00:06:24] daniel dot oconnor at gmail dot com
Description:
------------
If you don't supply a detail param in the constructor of SoapFault, the
property doesn't exist.
See also bug #39357
Reproduce code:
---------------
<?php
$sf = new SoapFault(null, null, null, "Details!");
var_dump($sf);
$sf = new SoapFault(null, null);
var_dump($sf);
Expected result:
----------------
Both objects define a detail property
Actual result:
--------------
object(SoapFault)#1 (8) {
["message:protected"]=>
string(0) ""
["string:private"]=>
string(0) ""
["code:protected"]=>
int(0)
["file:protected"]=>
string(17) "C:\soap_fault.php"
["line:protected"]=>
int(2)
["trace:private"]=>
array(0) {
}
["faultstring"]=>
string(0) ""
["detail"]=>
string(8) "Details!"
}
object(SoapFault)#2 (7) {
["message:protected"]=>
string(0) ""
["string:private"]=>
string(0) ""
["code:protected"]=>
int(0)
["file:protected"]=>
string(17) "C:\soap_fault.php"
["line:protected"]=>
int(6)
["trace:private"]=>
array(0) {
}
["faultstring"]=>
string(0) ""
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46792&edit=1