ID:               37927
 Comment by:       wharmby at uk dot ibm dot com
 Reported By:      massimiliano_ciceri at it dot ibm dot com
 Status:           Assigned
 Bug Type:         COM related
 Operating System: windows 2000
 PHP Version:      5.1.4
 Assigned To:      wez
 New Comment:

I suspect the 2nd problem reported here, i.e "IE automation object
NewWindow event cannot be cancelled." is the same issue has reported in
defect 34564 for which I am currently working on a fix.


Previous Comments:
------------------------------------------------------------------------

[2006-06-27 13:56:18] massimiliano_ciceri at it dot ibm dot com

$testcase value should be set to 1 for the first test as i mean in the
source description...
thanks to all of you.

------------------------------------------------------------------------

[2006-06-27 13:47:31] massimiliano_ciceri at it dot ibm dot com

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 this bug report at http://bugs.php.net/?id=37927&edit=1

Reply via email to