From:             massimiliano_ciceri at it dot ibm dot com
Operating system: windows 2000
PHP version:      5.1.4
PHP Bug Type:     COM related
Bug description:  newwindow2 & newwindow

Description:
------------
Problem with:
1. IE automation object NewWindow2 event does not trigger.
2. IE automation object NewWindow event cannot be cancelled.
This has been tested on PHP 5.1.4 and PHP 6 CVS and also on PHP 5 CSV.
Regards, Massimiliano 

Reproduce code:
---------------
<?php

// 21.06.2006 reproducing bugs for NewWindow2 & NewWindow
//            instruction :
//            1. run this with PHP cli 5.1.4 or PHP 6 CSV
//            2. when the PHP home page completed in IExplore, try open a
link in a new window
//            problem (1): the NewWindow2 event will not trigger as
espected...
//            3. try switch var testcase value to 2 to simulate second
problem
//            problem (2): the NewWindow event trigger but you are not
able to Cancel
//                         it... A new page will be created and opened on
the target url
//                         you clicked on.

$testcase = 2;  // switch test code from case=1 to case=2

class IEEventSinker {
  var $terminated = false;
  var $newWindowOpened = false;

  function NewWindow(&$ppDisp, &$Cancel) {
    $this->newWindowOpened = true;
    echo "<1>NewWindow event was fired.\n";
//   $Cancel=true;                  // php 4 style ...
    variant_set($Cancel,true);      // php 5 style ...
    echo "trying cancelling NewWindow event...\n";
    return;
  }
  function NewWindow2(&$ppDisp, &$Cancel) {
    $this->newWindowOpened = true;
    echo "<2>NewWindow2 event was fired.\n";
//  $Cancel=true;
    variant_set($Cancel,true);
    return;
  }
  function OnQuit() {
    $this->terminated = true;
    print "Browser Quit...\n";
  }
}

$ie = new COM("InternetExplorer.Application");
if ($testcase==1) {   // reproduce NewWindow2 problem
  $sink1 = new IEEventSinker();
  com_event_sink($ie, $sink1, "DWebBrowserEvents2");
}
if ($testcase==2) {   // reproduce NewWindow problem
  $sink2 = new IEEventSinker();
  com_event_sink($ie, $sink2, "DWebBrowserEvents");
}

$ie->Visible = true;
$ie->Navigate2("http://www.php.net",0);

if ($testcase==1) {   // reproduce NewWindow2 problem
  while(!$sink1->terminated) {
    com_message_pump(1280);
  }
}
if ($testcase==2) {   // reproduce NewWindow problem
  while(!$sink2->terminated) {
    com_message_pump(1280);
  }
}
unset($ie);
?>


Expected result:
----------------
NewWindow2 event received by the sink class.
At least be able to cancel the event NewWindow. 

Actual result:
--------------
1) NewWindow2 event not triggered at all.
2) NewWindow event trigger but cannot cancel it.

-- 
Edit bug report at http://bugs.php.net/?id=37927&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37927&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37927&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37927&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37927&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37927&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37927&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37927&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37927&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37927&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37927&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37927&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37927&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37927&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37927&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37927&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37927&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37927&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37927&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37927&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37927&r=mysqlcfg

Reply via email to