Edit report at http://bugs.php.net/bug.php?id=54953&edit=1
ID: 54953
User updated by: willem dot stuursma at hyves dot nl
Reported by: willem dot stuursma at hyves dot nl
-Summary: Implements SPL Interfaces wont work on mapped
classes
+Summary: Implemented SPL Interfaces wont work on mapped
classes
Status: Open
Type: Bug
Package: SOAP related
Operating System: n/a
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
(corrected typo in bug title)
Previous Comments:
------------------------------------------------------------------------
[2011-05-30 14:44:28] willem dot stuursma at hyves dot nl
Description:
------------
If you implement the Iterator interface on one of the classes that you
use in the
classmap that you pass to SoapClient::SoapClient(), it does not work. If
you use
foreach() on the object that implements the interface it just iterates
of the
properties of the object instead of using the custom iterator you
implemented.
Test script:
---------------
Not a full working code since this requires a SOAP service, but this
gives you the gist:
class Bar implements Iterator { /*...*/ }
$bar = $soapClient->someFunc() // say this is an object returned by a
SOAP client call and was mapped to class Bar
foreach ($bar as $key => $value) {
// Just iterates over each property
}
$baz = new Bar();
foreach ($baz as $key => $value) {
// Works as expected
}
Expected result:
----------------
I expect the custom iterator to be used when I iterator over an object
returned by
the SOAPClient.
Actual result:
--------------
Custom iterator is ignored, I get just regular iteration over all
properties of
the class Bar.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54953&edit=1