|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35689 Object of type com did not create an Iterator
Submitted: 2005-12-15 20:30 UTC Modified: 2005-12-16 00:05 UTC
From: jamie dot layne at gmail dot com Assigned: Wez (profile)
Status: Not a bug Package: COM related
PHP Version: 5.1.1 OS: Windows Server 2003
Private report: No CVE-ID: None
 [2005-12-15 20:30 UTC] jamie dot layne at gmail dot com
The recommended way of iterating over COM as per is to use the foreach($com as $ob) method, as opposed to the old $com->Next() approach.

This hasn't been working for objects of type COM or VARIANT.

Windows Server 2003
PHP 5.1.1

Reproduce code:
-- Example --
$word = new COM("word.application"); 
foreach ($word as $obj) { 
echo $obj. "<br>"; 

Expected result:
List of properties for the desired COM object

Actual result:
Object of type com did not create an Iterator

Similar error:
Object of type variant did not create an Iterator


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-16 00:05 UTC]
COM objects don't have that behaviour.
foreach() will ask the COM object for its default property and request an iteratable interface from it.
If it can't get one, you get that error.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Dec 01 20:05:53 2022 UTC