#31040 [NEW]: Bad parameters when getting some events from browser
| From: | jeanpierre dot vincent at gmail dot com | Date: | Thu, 09 Dec 2004 17:25:35 +0000 |
| Subject: | #31040 [NEW]: Bad parameters when getting some events from browser | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-69983@lists.php.net to get a copy of this message | ||
From: jeanpierre dot vincent at gmail dot com
Operating system: W2K WinXP
PHP version: 5.0.2
PHP Bug Type: COM related
Bug description: Bad parameters when getting some events from browser
Description:
------------
For some events of the IE browser, parameters given take value 0 and are
of boolean type.
For example : BeforeNavigate2, BeforeNavigate and CommandStateChange,
whereas events like DocumentComplete work fine.
Here is the example code from http://www.php.net/com-event-sink, which I
simply added BeforeNavigate2. Launch it from a browser or CLI.
Reproduce code:
---------------
class IEEventSinker {
var $terminated = false;
// just after Browser understands he has to navigate
function BeforeNavigate2(&$pDisp, &$url, &$Flags, &$TargetFrameName,
&$PostData, &$Headers, &$Cancel) {
foreach(func_get_args() as $id => $valeur) {
// if the problem occurs ...
if($valeur == 0)
print $id.' = '.$valeur.' of type
'.variant_get_type($valeur)."\n";
}
// if the problem doesnt, $url is filled
if($url != 0)
echo "you'll navigate on $url\n";
}
// when all objects of page are loaded
function DocumentComplete(&$dom, $url) {
echo "Document $url complete\n";
}
// when closing browser
function OnQuit() {
echo "Quit!\n";
$this->terminated = true;
}
}
$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("http://www.php.net");
while(!$sink->terminated) {
com_message_pump(4000);
}
$ie = null;
Expected result:
----------------
you'll navigate on http://www.php.net/
Document http://www.php.net/ complete
Quit!
Actual result:
--------------
0 = 0 of type 11
1 = 0 of type 11
2 = 0 of type 11
3 = 0 of type 11
4 = 0 of type 11
5 = 0 of type 11
6 = 0 of type 11
Document http://www.php.net/ complete
Quit!
--
Edit bug report at http://bugs.php.net/?id=31040&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31040&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31040&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31040&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31040&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31040&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31040&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31040&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31040&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31040&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31040&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31040&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31040&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31040&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31040&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31040&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31040&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31040&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31040&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31040&r=mysqlcfg