From: csaba at alum dot mit dot edu
Operating system: Win XP Pro
PHP version: 5.2.3
PHP Bug Type: COM related
Bug description: Cannot iterate IE's event object
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 bug report at http://bugs.php.net/?id=42413&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42413&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42413&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42413&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42413&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42413&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42413&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42413&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42413&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42413&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42413&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42413&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42413&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42413&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42413&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42413&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42413&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42413&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42413&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42413&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42413&r=mysqlcfg