Bug #54953 [Opn]: Implemented SPL Interfaces wont work on mapped classes
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
[PHP-BUG] Bug #54953 [NEW]: Implements SPL Interfaces wont work on mapped classes
From: Operating system: n/a PHP version: 5.3.6 Package: SOAP related Bug Type: Bug Bug description:Implements SPL Interfaces wont work on mapped classes 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 bug report at http://bugs.php.net/bug.php?id=54953&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54953&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54953&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54953&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54953&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54953&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54953&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54953&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54953&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54953&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54953&r=support Expected behavior: http://bugs.php.net/fix.php?id=54953&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54953&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54953&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54953&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54953&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=54953&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54953&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54953&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54953&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54953&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54953&r=mysqlcfg