|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-09-04 21:13 UTC] csaba at alum dot mit dot edu
Description:
------------
When I attempt to do
$doc = new COM("HTMLFile");
this results in warnings that Type Library constants True and False are already defined. Otherwise, the script runs fine.
The equivalent code as a .vbs file runs wihtout complaints
Csaba Gabor from Vienna
Reproduce code:
---------------
<?php
$doc = new COM("HTMLFile");
$win = $doc->parentWindow;
print ($doc->location . "\n");
$win->ExecScript(
"window.keepLooping=true");
$win->setTimeout (
"alert('timeout works');
window.keepLooping=false;", 2000);
while ($win->keepLooping)
com_message_pump(200);
print ("Done Looping");
?>
Expected result:
----------------
The only thing I expect to see printed is:
about:blank
Done Looping
Actual result:
--------------
Warning: com::com(): Type library constant True is already defined in C:\test2.php on line 2
Warning: com::com(): Type library constant False is already defined in C:\test2.php on line 2
about:blank
Done Looping
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 03:00:01 2025 UTC |
There is another variant of this which crops up from time to time (I am using version 5.2.6). Unfortunately, I cannot detect any pattern in when it happens. It only happens with low frequency (around 2 percent of the time), but when it happens my screen is filled with 31 error warnings. The following line $oFSO = new COM("Scripting.FileSystemObject"); will (sometimes) cause 31 warnings of the following type: Warning: com::com(): Type library constant BinaryCompare is already defined in C:\phpScripts\myScript.php on line 32 The specific list of constants it complains about is: BinaryCompare TextCompare DatabaseCompare ForReading ForWriting ForAppending TristateTrue TristateFalse TristateUseDefault TristateMixed Normal ReadOnly Hidden System Volume Directory Archive Alias Compressed UnknownType Removable Fixed Remote CDRom RamDisk WindowsFolder SystemFolder TemporaryFolder StdIn StdOut StdErr This has even happened when the script was the very first thing that I ran after a reboot. In any case, I would expect that if the value of the constants is the same, then I not get the complaint.