Bug #67641 [Com]: SoapFault Traversable ?

From: Date: Fri, 18 Jul 2014 11:02:46 +0000
Subject: Bug #67641 [Com]: SoapFault Traversable ?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186723@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
 Comment 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:

And one thing:
"They certainly are visible. Undocumented, but visible." Not all of them:

<?php

print "SoapFault:\n";
foreach(new Soapfault(null, null) as $k => $v) 
    print "$k: $v\n";

// output:
// SoapFault:
// faultstring:

// or

print "SoapFault:\n";
foreach(new Soapfault(null, null, null, null, null, null) as $k => $v) 
    print "$k: $v\n";

// output:
// SoapFault:
// faultstring: 
// headerfault:


Previous Comments:
------------------------------------------------------------------------
[2014-07-18 10:56:47] vosa at binaryparadise dot com

Thank you

------------------------------------------------------------------------
[2014-07-18 09:21:02] requinix@php.net

...and here is where I was expecting to see an automatic comment.

https://bugs.php.net/bug.php?id=67648

------------------------------------------------------------------------
[2014-07-18 09:14:35] requinix@php.net

>"faultstring" and "faultcode" are NOT visible (or documented) properties.
They certainly are visible. Undocumented, but visible.

>Developers don't want to search "in a few places", but in official PHP reference.
I'm not saying the docs are perfect as they are. I merely took the extra minute to do some
research to see where those values were coming from - something I'd like to think other
developers would do too.

I was kinda hoping you would make the doc bug for it, but I can do that:

------------------------------------------------------------------------
[2014-07-18 07:16:17] vosa at binaryparadise dot com

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".

------------------------------------------------------------------------
[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.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=67641


--
Edit this bug report at https://bugs.php.net/bug.php?id=67641&edit=1


Thread (7 messages)

« previous php.bugs (#186723) next »