php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54953 Implemented SPL Interfaces wont work on mapped classes
Submitted: 2011-05-30 14:44 UTC Modified: 2011-05-30 15:54 UTC
From: willem dot stuursma at hyves dot nl Assigned:
Status: Open Package: SOAP related
PHP Version: 5.3.6 OS: n/a
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-05-30 14:44 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [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
(corrected typo in bug title)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC