ID: 42413
Updated by: [EMAIL PROTECTED]
Reported By: csaba at alum dot mit dot edu
-Status: Open
+Status: Assigned
Bug Type: COM related
Operating System: Win XP Pro
PHP Version: 5.2.3
-Assigned To:
+Assigned To: wharmby
New Comment:
Assigned to the maintainer.
Previous Comments:
------------------------------------------------------------------------
[2007-08-24 12:06:04] csaba at alum dot mit dot edu
Description:
------------
I can't iterate over IE's $ie->document->createEventObject() with PHP
whereas I can in IE.
Reproduce code:
---------------
<?php
// create a new internet explorer instance
$ie = new COM("InternetExplorer.Application");
// So the alerts can be seen
$ie->visible = true;
// ensure a document exists within ie
$ie->Navigate2 ("about:blank");
while ($ie->readyState!=4) usleep(100000);
// convenience
$doc = $ie->document;
$window = $doc->parentWindow;
// required - var must be declared
$window->execScript ("var evt='';");
// create an event object
$window->evt = $doc->createEventObject();
// proof the object is valid, iteratable
$window->execScript("
var str=''; var idx;
for (idx in evt)
str+=idx+'; ';
alert('Keys: '+str);");
// Bug: can't iterate the object in PHP
foreach ($window->evt as $prop => $val)
print "<br>$prop ";
// ensure ie is still alive
$window->execScript("alert('Alive');");
$ie->quit(); // necessary since visible
?>
Expected result:
----------------
I expect PHP not to die at the foreach
I expect the same text to be output as with the alert
Actual result:
--------------
PHP falls over upon hitting the foreach loop with:
Fatal error: Uncaught exception 'Exception' with message 'Object of
type variant did not create an Iterator' in c:\phpBugs\foreach.php: 28
Stack trace:
#0 C:\phpBugs\foreach.php(28): unknown()
#1 {main} thrown in C:\phpBugs\foreach.php on line 28
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42413&edit=1