From: jeanpierre dot vincent at gmail dot com
Operating system: windows 2000, xp
PHP version: 5.0.1
PHP Bug Type: COM related
Bug description: com_event_sink does not take default event interface
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.
--
Edit bug report at http://bugs.php.net/?id=32170&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32170&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32170&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32170&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32170&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32170&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32170&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32170&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32170&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32170&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32170&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32170&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32170&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32170&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32170&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32170&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32170&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32170&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32170&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32170&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32170&r=mysqlcfg