Bug #67641 [Nab]: SoapFault Traversable ?
| From: | vosa at binaryparadise dot com | Date: | Fri, 18 Jul 2014 07:16:18 +0000 |
| Subject: | Bug #67641 [Nab]: SoapFault Traversable ? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186717@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67641&edit=1
ID: 67641
User updated by: vosa at binaryparadise dot com
Reported by: vosa at binaryparadise dot com
Summary: SoapFault Traversable ?
Status: Not a bug
Type: Bug
Package: SOAP related
Operating System: debian
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Your link about object iterations says: "By default, all visible properties will be used for
the iteration."
"faultstring" and "faultcode" are NOT visible (or documented) properties.
Developers don't want to search "in a few places", but in official PHP reference.
I think it's not much work to write few words in documentation about this "feature".
Previous Comments:
------------------------------------------------------------------------
[2014-07-17 19:29:36] requinix@php.net
Objects that are not Traversable can still be iterated over using a default behavior: the set of
accessible properties and their values.
http://php.net/manual/en/language.oop5.iterations.php
As mentioned in a few places, SoapFault has undocumented properties "faultstring" and
"faultcode". Adding that to the default foreach behavior results in the output you see.
------------------------------------------------------------------------
[2014-07-17 11:50:12] vosa at binaryparadise dot com
Description:
------------
---
From manual page: http://www.php.net/class.soapfault
---
There's strange behavior of SoapFault instance when used in foreach construct. It behave almost
like Transversable object, but it shouldn't. SoapFault extends Exception and none of these
classes implements Transversable interface...
Test script:
---------------
print "Exception:\n";
foreach(new Exception('message') as $k => $v)
print "$k: $v\n";
print "SoapFault:\n";
foreach(new Soapfault('faultcode', 'faultstring') as $k => $v)
print "$k: $v\n";
Expected result:
----------------
Exception:
SoapFault:
Actual result:
--------------
Exception:
SoapFault:
faultstring: faultstring
faultcode: faultcode
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67641&edit=1