php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33086 Weird COM behavior differences in CGI and CLI
Submitted: 2005-05-20 17:17 UTC Modified: 2005-05-28 01:00 UTC
Votes:6
Avg. Score:2.2 ± 0.7
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: hmp96 at yahoo dot co dot uk Assigned:
Status: No Feedback Package: COM related
PHP Version: 5.0.4 OS: Windows XP SP2
Private report: No CVE-ID: None
 [2005-05-20 17:17 UTC] 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>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-20 20:39 UTC] wez@php.net
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?

 [2005-05-28 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 14:01:29 2024 UTC