php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32170 com_event_sink does not take default event interface
Submitted: 2005-03-03 12:14 UTC Modified: 2005-03-17 01:00 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:3 (100.0%)
From: jeanpierre dot vincent at gmail dot com Assigned:
Status: No Feedback Package: COM related
PHP Version: 5.0.1 OS: windows 2000, xp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
44 - 16 = ?
Subscribe to this entry?

 
 [2005-03-03 12:14 UTC] jeanpierre dot vincent at gmail dot com
Description:
------------
the function com_event_sink is documented like this:
bool com_event_sink ( variant comobject, object sinkobject [, mixed sinkinterface] ).
but the sinkinterface  does not take value of the default com object event interface so optional is useless because the developper must know all default object event sink interface.
 

Reproduce code:
---------------
<?php
class IEEventSinker {
  var $terminated = false;

// when all objects of page are loaded
	function DocumentComplete(&$dom, $url) {
		GLOBAL $ie;
		$GLOBALS['elem']=$ie->document->getElementById('test');
		if ($GLOBALS['elem']!=null)
		{
			com_event_sink($GLOBALS['elem'],$this /*,'HTMLAnchorEvents'*/);
			
		}
		
		
	}
// when closing browser
	function OnQuit() {
		echo "Quit!\n";
		$this->terminated = true;
	}
// when clicking in url
	function onclick() {
		echo "click!\n";
		
	}
	
}
$ie = new COM("InternetExplorer.Application");
// note that you don't need the & for PHP 5!
$sink = new IEEventSinker();
com_event_sink($ie, $sink, "DWebBrowserEvents2");
$ie->Visible = true;

$ie->Navigate('c:\test.html');
while(!$sink->terminated) {
  com_message_pump(4000);
}
$ie = null;
?>
/////////////////////////////////////////////////////////
c:\test.html

<html>
<body >
<A id='test' href='#'>test</A>
</body>
</html>





Expected result:
----------------
browser is launching, navigate on test.html file.
when we click to url test the message is to be written in the console :
 
Click!

Actual result:
--------------
no message written.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-04 10:00 UTC] derick@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip
 [2005-03-09 11:48 UTC] jeanpierre dot vincent at gmail dot com
with this version we have a big regression,it does not solve the bug and a simple example of catching DocumentComplete event of WebBrowser does not work as before : it's not even called.
 [2005-03-09 21:40 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-03-17 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC