|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-05-30 15:54 UTC] 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
[2011-05-30 15:54 UTC] willem dot stuursma at hyves dot nl
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 01:00:01 2025 UTC |
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.