ID:               35875
 Updated by:       [EMAIL PROTECTED]
 Reported By:      csaba at alum dot mit dot edu
-Status:           Assigned
+Status:           Feedback
 Bug Type:         COM related
 Operating System: WinXP Pro
 PHP Version:      5.1.1
 Assigned To:      wharmby
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Hi Csaba,
        Is this still an issue for you with the latest level of PHP ? 

I have taken your supplied testcase and corrected the  typo:

        popup ("In the catch")==> mypopup ("In the catch")

to get it to run from command line and it runs as you describe; 2
pop-ups before IE is terminated and 2 after. 

Next I scheduled it to run with AT command and again all was OK. I ran
it as both: 

AT 13:18 %comspec% "/K php <path.to.testcase>"

and 

AT 13:18 /interactive %comspec% "/K php <path.to.testcase>"

and both ran fine at the specified time; I just had to use Windows 
Task Manager in the first case to dispose of IE and so prompt the 3rd 
and 4th popups.

Next I scheduled it using schtasks. On my Windows XP system I do have a
user-id & password and I scheduled the task in 2 ways:

schtasks /Create /SC once /TN schTest /TR "php.exe <path.to.testcase>"

/ST 14:12:00 /RU "<computer name>\<id>"
  (and supplied password when promoted) 

and 

schtasks /Create /SC once /TN schTest /TR "php.exe <path.to.testcase>"

/ST 14:15:00 /RU "System"

and again both times the script ran at the specified time with all 4
pop-ups. 

Can you please re-try with latest PHP snapshot on your system and let
me know the result.

Regards
        Andy 


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

[2007-04-11 13:16:56] [EMAIL PROTECTED]

Hi Wez,
   I will take a look at this one next
Regards
  Andy 



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

[2006-01-03 14:11:45] [EMAIL PROTECTED]

Assigned to the maintainer, don't expect any response.

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

[2006-01-03 11:55:03] csaba at alum dot mit dot edu

I have some additional information on this problem.  If I schedule the
php task using SchTasks as "Gabor", shown below, then the php script
runs fine.  In order to be able to do this on my single user, no
password system I must first allow Scheduled Tasks to be run without
password as described here:
http://groups.google.com/group/microsoft.public.windowsxp.general/browse_frm/thread/c1b603be72394ee2/

Then, at the command window I type (on one wrapped line):
C:\phpApps>schtasks /Create /SC once /TN schTest /TR "php.exe
c:\phpApps\schTest.php" /ST 11:23:00 /RU "Gabor"


Just to repeat the original problem:  There is a discrepancy when
scheduling (as SYSTEM - the default for AT) the php task vs. the
vbscript task to do essentially the same thing.  The php task errors
when its created IE attempts to run code within the task while the
vbscript task runs fine.  Both scripts run fine when run directly from
the command window.

Csaba

PS.  The problem is also exhibited if I ask IE to call into PHP
directly (via a PHP class) instead of directing it into a ScriptControl.
 I illustrated the method shown above because it is the direct analogue
of the standard VBScript approach, but I can also provide a "pure" PHP
way.  However, in that case, when the script is scheduled as SYSTEM (via
the AT command) the error is: Permission denied

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

[2006-01-03 03:52:45] csaba at alum dot mit dot edu

Description:
------------
My script brings up an instance of IE, and then it places onto IE a
function that will execute one of the script's functions (within the
script's environment).  This is a normal scenario usually achieved
through com_event_sink in PHP.  However, I have implemented this
independent of events.  I have both a VB and PHP version, both are
working fine from the command line, thanks very much.

The problem is that when I run the PHP version using the scheduler
(either AT or SchTask), I get an IE error IE right at the point that it
tries to call back into the script (a permissions issue?).  The
scheduled VB version works fine, and if I schedule PHP to invoke the VB
version that works just fine, too.

Csaba Gabor from Vienna

Reproduce code:
---------------
<?php
$ie = new COM("InternetExplorer.Application");  // new IE
$ie->visible = true;
$ie->Navigate2("about:blank");              // empty DOM
while ($ie->readyState<4) usleep(10000);    // wait for IE
$window =$ie->document->parentWindow;
$window->execScript("window.doneP=false");  // init var

$oScript=new COM("MSScriptControl.ScriptControl"); 
$oScript->Language = "VBScript";
$oScript->AddCode('Sub EvtWrapper()
    CreateObject("WScript.Shell").Popup _
      "ScriptControl reached", 4, "WScript popup", 131120
    End Sub');

$oScript->AddObject ("mydoc", $ie->document);
$oScript->ExecuteStatement(
    'mydoc.onclick=GetRef("EvtWrapper")');
$window->execScript(
    "window.myfunc=window.document.onclick");

$window->setTimeout("window.myfunc()",100);

mypopup("At com_message_pump");
try { while (!$window->doneP) com_message_pump(500); }
catch (Exception $e) { popup ("In the catch"); }
mypopup ("Done with script");

function mypopup ($text) {
   $oWSH = new COM("WScript.Shell");
   $oWSH->Popup($text, 4, "PHP Popup", 131120); }
?>

Expected result:
----------------
I expect this script, schTest.php, to not error when it is scheduled
with AT as:
AT 14:10 %comspec% "/K php c:\path\to\schTest.php"

In particular, just as when it is run directly, IE should come up, and
then there should be two popups: "At com_message_pump" followed by
"ScriptControl reached".  Once IE is dismissed, there should be two more
popups: "In the catch" and "Done with script"

Actual result:
--------------
When SchTest.php is run directly (or via a .vbs invocation) then all
four popups show normally.  However, when schTest.php is scheduled
through AT, then there is an IE error saying
Line: 0
Error: Object doesn't support this property or method.

When I try the scheduling through SchTask (same results as with AT),
then it is scheduled as NT AUTHORITY\SYSTEM (no password).  I'm the only
user on my system and since I don't have a password, I haven't figured
out how to schedule tasks to run under my user name.

I am happy to provide the corresponding VBScript code if it would be
helpful.


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


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

Reply via email to