php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42551 new COM("HTMLFile") => warnings
Submitted: 2007-09-04 21:13 UTC Modified: 2015-04-07 18:39 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: csaba at alum dot mit dot edu Assigned: wharmby (profile)
Status: Not a bug Package: COM related
PHP Version: 5.2.4 OS: Win XP Pro
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: csaba at alum dot mit dot edu
New email:
PHP Version: OS:

 

 [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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-05 12:44 UTC] jani@php.net
Assigned to the maintainer.
 [2009-03-17 13:23 UTC] csaba at alum dot mit dot edu
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.
 [2015-04-07 18:39 UTC] cmb@php.net
-Status: Assigned +Status: Not a bug
 [2015-04-07 18:39 UTC] cmb@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Oct 04 17:03:58 2022 UTC