|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57283 Interator failure
Submitted: 2006-10-06 06:55 UTC Modified: 2006-11-28 09:27 UTC
From: simonslaws at googlemail dot com Assigned:
Status: Not a bug Package: SCA_SDO (PECL)
PHP Version: 5.1.4 OS: XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: simonslaws at googlemail dot com
New email:
PHP Version: OS:


 [2006-10-06 06:55 UTC] simonslaws at googlemail dot com
I am trying to us an iterator to iterator across an SDO many valued property. 

        $itemIterator = $rss->channel->item->getIterator();
        while ( $iterator->valid() && $item == null ) {
            if ($itemIterator->current()->title == $title ) {
                $item = $itemIterator->current();

When running this I get: 

[Sun Oct 01 11:21:18 2006] [error] [client] PHP Fatal error:
Call to undefined method SDO_DataObjectList::getIterator() in
C:\\simon\\Projects\\Eclipse3.2\\ajax-rss\\sdoajax.php on line 70

Reproduce code:
With array.xsd
    <complexType name="ArrayContainerType">
            <element name="Array" type="string" minOccurs="1" maxOccurs="unbounded"/>
    <element name="ArrayContainer" type="tns:ArrayContainerType"/>
and code
$xmldas = SDO_DAS_XML::create('array.xsd');

$array_doc 		 = $xmldas->createDocument();
$array_container = $array_doc->getRootDataObject(); 

$array_container->Array[] = "arrayitem1";
$array_container->Array[] = "arrayitem2";
$array_container->Array[] = "arrayitem3";

$itemIterator = $array_container->getIterator();
        while ( $iterator->valid() && $item == null ) {
            echo "An Item ";


Expected result:
Print out the three elements of the array

Actual result:
The filename, directory name, or volume label syntax is incorrect.
PHP Fatal error:  Call to undefined method SDO_DataObjectImpl::getIterator() in
C:\simon\Projects\Eclipse3.2\phpscripts\peclx.php on line 11


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-28 09:27 UTC]
Thank you for taking the time to write to us, but this is not
a bug.

SDO_DataObject doesn't have a getIterator method. There are SPL classes which let you do this. You can use an IteratorIterator (really) to get a userland view into the iteration functions, for example:

    $iter = new IteratorIterator($do, 'SDO_DataObjectImpl');

(Note that you have to use the implementation class name, even though the SDO_DataObject interface does itself extend Traversable, but SPL wants the name of a concrete class.)

Once you have your iterator you can then do all the iterator operations on it: rewind(), key(), current(), next(), and valid().

A refinement would be to add an SDO_Iterator class (c.f. SimpleXMLIterator) as a subclass of IteratorIterator, which would work with all the Traversable SDO objects (DataObject, List, Sequence). This would implement getIterator() and look a bit nicer than the above. I'll put this on the wish list.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Dec 05 12:03:38 2021 UTC