ID:               37927
 Updated by:       [EMAIL PROTECTED]
-Summary:          newwindow2 & newwindow
 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
+Assigned To:      wharmby
 New Comment:

Issue with NewWindow2 event now fixed in HEAD. Will send patch to Ilia
for approval for drop into 5.2


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

[2007-01-26 16:48:32] wharmby at uk dot ibm dot com

Patch for issue with DWebBrowserEvents2::NewWindow2 event 
handler not getting called posted on internals list for 
review. You will need the fix for defect 34564 as well to enable you to
cancel any navigation though.

As for probelms with DWebBrowserEvents::NewWindow I believe 
these are IE related and the DWebBrowserEvents interface 
should no longer be used; the MSDN page which describes it 
does say its obsolete and to use DWebBrowserEvents2 instead.

During my investigation I found 2 problems with the DWebBrowserEvents
interface which appear IE related and not issues in the COM extension
itself: 

(1) The interface defines NewWindow as an event that takes 
just 2 arguments. However it appears to actually takes 6 !!.

The COM trace shows:  

[7060] T=00001de4 
[7060]  PHP:IEEventSinker InvokeEx
[7060] T=00001de4 
[7060] -- Invoke: 107            newwindow [9] flags=00000001 args=6
[7060] T=00001de4 
[7060] alloc zval for arg 0 VT=00000008
[7060] T=00001de4 
[7060] alloc zval for arg 1 VT=00000003
[7060] T=00001de4 
[7060] alloc zval for arg 2 VT=00000008
[7060] T=00001de4 
[7060] alloc zval for arg 3 VT=0000400c
[7060] T=00001de4 
[7060] alloc zval for arg 4 VT=00000008
[7060] T=00001de4 
[7060] alloc zval for arg 5 VT=0000400b
[7060] T=00001de4 
[7060] arguments processed, prepare to do some work
[7060] T=00001de4 
[7060] function called ok

So defining the event handler as described on the MSDN site 
will result in unpredictable behaviour; certainly navigation
will not be prevented with the supplied testcase.

The 6th argument is of type VT_VOOL so I am guessing that's the
"cancel" argument. By adding dummy arguments to the event handler as
follows: 

 function NewWindow(&$dum1, $dum2, $dum3, $dum4, $dum5, &$Cancel) {
    $this->newWindowOpened = true;
    echo "NewWindow event was fired.\n";
    variant_set($Cancel,true);
    return;
  }

and with the fix for defect 345764 applied then the
NewWindow event is fired the first time its tried and
navigation is cancelled. However any subsequent attempt to 
open any link in a new window is also prevented even though
not all attempts result in a NewWindow event being reported
and occasionally I am unable to close down IE so perhaps my 
guess at what the 6th argument does is invalid!!. Everything
is fine when DWebBrowserEvents2 interface is used. 


(2) The supplied testcase defines the "OnQuit" event which
is, according to MSDN, defined by the DWebBrowserEvents
interface. Alas not !! Or at least not using IE  Version 6. The actual
event name appears to be  "Quit" and not "OnQuit". Again here is the
COM trace of the event reported 
using the supplied test case:

[6012]  PHP:IEEventSinker InvokeEx
[6012] T=00000ff0 
[6012] -- Invoke: 103      quit [4] flags=00000001 args=1
[6012] T=00000ff0 
[6012] alloc zval for arg 0 VT=0000000b
[6012] T=00000ff0 
[6012] arguments processed, prepare to do some work
[6012] T=00000ff0 
[6012] failed to call func 

This clearly shows the event is named "quit" and so the call
to the any handler named "onQuit" fails. Modifying the testcase to
define a method "Quit" and the user defined method fires OK.

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

[2007-01-25 19:46:46] wharmby at uk dot ibm dot com

I have recreated the issue with NewWindow2 event and I believe I have
identified the issue; problem in COM code processing in/out arguments
of type VT_DISPATCH|VT_BYREF. Will check out fix tomorrow and post
patch to internals list if its OK.

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

[2007-01-25 17:34:27] wharmby at uk dot ibm dot com

I will take a look at this one next.

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

[2007-01-23 16:47:39] wharmby at uk dot ibm dot com

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.

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

[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.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/37927

-- 
Edit this bug report at http://bugs.php.net/?id=37927&edit=1

Reply via email to