#42585 [NEW]: die() in event handler => PHP hangs

From: Date: Fri, 07 Sep 2007 09:49:16 +0000
Subject: #42585 [NEW]: die() in event handler => PHP hangs
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117268@lists.php.net to get a copy of this message
From: csaba at alum dot mit dot edu Operating system: Win XP Pro PHP version: 5.2.4 PHP Bug Type: COM related Bug description: die() in event handler => PHP hangs Description: ------------ If I have a COM object call into PHP (via com_event_sink or IE's window.setTimeout) with a die() within the called code, then PHP hangs. In the example below, IE comes up and waits around for 4 seconds, after which an $ie->quit() is issued. In the event handler (function OnQuit()) a die() is issued. While IE does shut down, PHP does not return me the command prompt. This is from PHP CLI, of course. Csaba Gabor from Vienna Reproduce code: --------------- <?php class IESink { public $terminated = false; public function TitleChange($text) { echo("title has changed: $text \n"); } public function OnQuit() { print "Quitting\n"; die(); print "Died\n"; $this->terminated = true; } } $ie = new COM("InternetExplorer.Application"); $ie->Visible = true; $sink = new IESink; com_event_sink($ie, $sink, "DWebBrowserEvents2"); $ie->Navigate("http://www.php.net/"); $start = time(); $quitted = false; while (!$sink->terminated) { com_message_pump(200); if (time()-$start>4 && !$quitted) { $quitted=true; $ie->quit(); } } print "Finished!\n"; ?> Expected result: ---------------- I expect to be shown the following three lines, ie to go away, AND for PHP to terminate: title has changed: PHP: Hypertext Preprocessor title has changed: PHP: Hypertext Preprocessor Quitting Actual result: -------------- The above 3 lines are shown, IE goes away, BUT php does not terminate. Also, note that if I manually shut IE down, instead of waiting the 4 seconds, then I get the following additional line (and PHP still hangs the cmd prompt): Fatal error: Call to undefined method com::quit() in Unknown on line 0 It seems to me that the while loop stays active, since that's the only place that $ie->quit() is issued. -- Edit bug report at http://bugs.php.net/?id=42585&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42585&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42585&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42585&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42585&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42585&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42585&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42585&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42585&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42585&r=support Expected behavior: http://bugs.php.net/fix.php?id=42585&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42585&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42585&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42585&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42585&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42585&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42585&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42585&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42585&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42585&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42585&r=mysqlcfg

« previous php.bugs (#117268) next »