|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31492 com_event_sink => crash when InternetExplorer.Application navigates away
Submitted: 2005-01-11 16:12 UTC Modified: 2005-06-20 12:00 UTC
From: csaba at alum dot mit dot edu Assigned:
Status: Closed Package: COM related
PHP Version: 5.0.4 OS: Win XP Pro
Private report: No CVE-ID: None
 [2005-01-11 16:12 UTC] csaba at alum dot mit dot edu
If I run the code below (essentially lifted from and (superzouz entry from 11 Oct 2003)) then I get the started and com_event_sink lines printed and then two identical title has changed lines:
title has changed: PHP: Hypertext Preprocessor

So far so good.
If I now go to the IE window and put<enter> into the location bar, and then have it search for something, I may or may not get additional title has changed messages (sometimes the next one is even the original php title bar.  Ie. when I navigate to, the third title has changed line might still be PHP: Hypertext Preprocessor.  But in any case, if I close the window, I will definitely get an error dialog:

Title: php.exe - Application Error
Text: The instruction at "0x7c911629" referenced memory at "0x00000000".  The memory could not be "written".

Click on OK to terminate the program
Click on CANCEL to debug the program

The actual first location varies, but it has always started with "0x7c91  The second one is usually all 0s though occasionally it has low numbers.  I have changed the message pump time, and sometimes it seems like this affects how soon I might get an error, but I haven't seen anything definitive yet.  The problem does not happen if I comment out the com_event_sink line and the while loop.

I am on Win XP Pro SP2 using IE 6
My antivirus definitions are up to date and Norton Antivirus has found a clean machine.

If there are other tests that I can do to facilitate tracking this problem down, please let me know.

My php.ini file is in the same directory as php.exe (I do not have Apache installed yet and I am running php.exe (from a directory outside where php.exe lives) from a CMD box.

Possibly related to ?

Csaba Gabor from Vienna

Reproduce code:
class IESink { 
   public $terminated = false; 
   public function TitleChange($text) { 
         echo("title has changed: $text \n"); 
    public function OnQuit() { 
        $this->terminated = true; 
        echo ("Quitting\n");
$ie = new COM("InternetExplorer.Application"); 
$ie->Visible = true; 
$sink = new IESink; 
print "started\n";
com_event_sink($ie, $sink, "DWebBrowserEvents2"); 
print "com_event_sink called\n";
while (!$sink->terminated) { 
print "finished!\n"; 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-28 21:08 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-03-09 01:29 UTC] csaba at alum dot mit dot edu
This is now working pretty spiffy.
The reason that I've taken so long to come back is because of
Until this bug was fixed, my Apache web server was useless.

Unfortunately, it is now experiencing random intermittent problems (which is why I don't file a separate problem).  The behaviour that I observe is that apache will report that it has to shut down (Apache HTTP Server has encountered a problem and needs to close.  We are sorry for the inconvenience.) and ask whether I want to submit a report to Microsoft.  However, I don't actually observe a little red dot in the icon with the feather in the bottom right of screen and as near as I can tell apache doesn't die.

The point is that there is some difference between the Feb 19 version and versions from the Feb 28 onwards that causes the nasty dialog to appear on my screen.  The pages that I'm running are too big, and I don't have a reliable test case for you at this point.

But anyway, I'm glad to see this bug worked out.  Thanks.
 [2005-06-15 02:22 UTC] csaba at alum dot mit dot edu
I am sorry to reopen this (and please let me know whether I should have filed a new bug report on it).  However, I have just now realized that this bug has regressed.

Specifically, the test code in this report was working as expected in the March 7 (latest) version (which had the intermitent Apache problem as described earlier).  It also works as expected in the latest build of PHP 5.1.0b1, downloaded today.

However, in both PHP code from March 11 (latest) and 5.0.4 (downloaded today) the symptoms are the same.  If, upon executing the code, I type into the address bar, I get no output in the DOS window, and if I then close IE, php.exe remains running.  However, there is no longer a crash.

Csaba Gabor from Vienna
 [2005-06-20 12:00 UTC]
If it works with PHP 5.1b1, it's fixed. Reopen ONLY if you can reproduce it with later releases! Next PHP 5 version will be 5.1, and there most likely will NOT be any 5.0.x releases.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Feb 05 11:05:50 2023 UTC