#33086 [Opn->Fbk]: Weird COM behavior differences in CGI and CLI
| From: | wez@php.net | Date: | Fri, 20 May 2005 18:39:29 +0000 |
| Subject: | #33086 [Opn->Fbk]: Weird COM behavior differences in CGI and CLI | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-79279@lists.php.net to get a copy of this message | ||
ID: 33086
Updated by: wez@php.net
Reported By: hmp96 at yahoo dot co dot uk
-Status: Open
+Status: Feedback
Bug Type: COM related
Operating System: Windows XP SP2
PHP Version: 5.0.4
New Comment:
I can assure you that PHP does absolutely nothing differently in the
COM extension, regardless of which SAPI is in use.
I suspect that this is somehow related to the CGI running with a more
restricted token than CLI, and this is not something that PHP can fix.
Please provide use variant_get_type() on the vendor fields to see if
there is any difference in the types coming back from there.
If you run the CGI from a dos box (eg: just like the CLI), are there
any differences?
Previous Comments:
------------------------------------------------------------------------
[2005-05-20 17:17:58] hmp96 at yahoo dot co dot uk
Description:
------------
I am having some weird differences when using COM in a CGI
environment while it works fine in a CLI environment.
Basically, I am querying the "WinMgmts:" using COM and the
WMI's WQL query I provide is "Select * From Win32_Product".
All fields are retrieved fine, except for the Vendor field
which is sometimes lacking information; this only happens
when the script is running in a CGI environment, but the
values are retrieved fine in a CLI environment, i.e. script
run from the command line.
The script in the "Reproduce Code" section will suffice
when testing in CGI and a CLI environment. Note, if you
are having problem running a WMI related script on IIS,
thats probably because the security needs to be tweaked
using WMI Control snap-in from MMC.
Reproduce code:
---------------
<pre>
<?php
$wmi = new COM("WinMgmts:root/cimv2");
$colProducts = $wmi->ExecQuery("Select * From Win32_Product");
echo "Applications Installed on Local Machine\r\n";
try {
foreach($colProducts as $objProduct) {
printf("Name: %s, Version: %s, Vendor: %s\r\n",
$objProduct->Name, $objProduct->Version, $objProduct->Vendor);
}
} catch (Exception $e) {
echo $e->GetMessage();
}
?>
</pre>
Expected result:
----------------
When run, it should fill the 'Vendor' field of the
Win32_Product class in a CGI/ISAPI environment. Basically
it should be same as the CLI environment's output. Even
some of the applications are missing when run in a CGI
environment.
Here is the CGI instance of the PHP script:
Applications Installed on Local Machine
Name: WebFldrs XP, Version: 9.50.5318, Vendor: Microsoft Corporation
Name: GFI LANguard Network Security Scanner 5.0, Version:
5.0.2004.0728, Vendor: GFI Software Ltd.
Name: Adobe Reader 6.0.1, Version: 006.000.001, Vendor: Adobe Systems
Incorporated
Name: McAfee VirusScan Enterprise, Version: 7.1.0, Vendor: Network
Associates
Name: Belkin Bluetooth Software, Version: 1.4.2.10, Vendor:
Name: ActivePerl 5.8.6 Build 811, Version: 5.8.811, Vendor:
ActiveState
Name: FileMaker Pro 6, Version: 6.0.1.0, Vendor: FileMaker, Inc.
Name: Java 2 Runtime Environment, SE v1.4.2_03, Version: 1.4.2_03,
Vendor:
Name: Microsoft Office Professional Edition 2003, Version: 11.0.6361.0,
Vendor: Microsoft Corporation
Name: HP Deskjet 3840, Version: 1.00.0000, Vendor:
Name: MSN Messenger 7.0, Version: 7.0.0777, Vendor: Microsoft
Corporation
Name: Microsoft .NET Framework 1.1, Version: 1.1.4322, Vendor:
Microsoft
Name: HighMAT Extension to Microsoft Windows XP CD Writing Wizard,
Version: 1.1.1905.1, Vendor: Microsoft Corporation
Name: VMware Workstation, Version: 4.0.0.4460, Vendor:
Actual result:
--------------
<pre>
Applications Installed on Local Machine
Name: WMI Tools, Version: 1.50.1131.0001, Vendor: Microsoft
Corporation
Name: MySQL Query Browser 1.1, Version: 1.1.5, Vendor: MySQL AB
Name: WebFldrs XP, Version: 9.50.5318, Vendor: Microsoft Corporation
Name: GFI LANguard Network Security Scanner 5.0, Version:
5.0.2004.0728, Vendor: GFI Software Ltd.
Name: Adobe Reader 6.0.1, Version: 006.000.001, Vendor: Adobe Systems
Incorporated
Name: McAfee VirusScan Enterprise, Version: 7.1.0, Vendor: Network
Associates
Name: Belkin Bluetooth Software, Version: 1.4.2.10, Vendor: WIDCOMM,
Inc.
Name: ActivePerl 5.8.6 Build 811, Version: 5.8.811, Vendor:
ActiveState
Name: FileMaker Pro 6, Version: 6.0.1.0, Vendor: FileMaker, Inc.
Name: Java 2 Runtime Environment, SE v1.4.2_03, Version: 1.4.2_03,
Vendor: Sun Microsystems, Inc.
Name: Microsoft Office Professional Edition 2003, Version: 11.0.6361.0,
Vendor: Microsoft Corporation
Name: HP Deskjet 3840, Version: 1.00.0000, Vendor: Hewlett-Packard
Name: MSN Messenger 7.0, Version: 7.0.0777, Vendor: Microsoft
Corporation
Name: Microsoft .NET Framework 1.1, Version: 1.1.4322, Vendor:
Microsoft
Name: HighMAT Extension to Microsoft Windows XP CD Writing Wizard,
Version: 1.1.1905.1, Vendor: Microsoft Corporation
Name: VMware Workstation, Version: 4.0.0.4460, Vendor: VMware, Inc.
</pre>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33086&edit=1