ID: 38840
Updated by: [email]rrichardsphp.net[/email]
Reported By: techscorpio at lxlabs dot com
-Status: Assigned
+Status: Bogus
Bug Type: COM related
Operating System: windows
PHP Version: 5.1.6
Assigned To: wez
New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.

Thank you for your interest in PHP.

dupe of bug #38719


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

[2006-09-15 10:31:45] techscorpio at lxlabs dot com

Description:
------------
Hi,
i am trying to warite a php script for administration of microsoft
virtual server when i use a COM "VirtualServer.Application" the object
is created but when i tried to access "VirtualMachines" etc,the COM
function will troughs error.



Reproduce code:
---------------
vb script:-

'Script Begins

On Error Resume Next

'Connect to Virtual Server
Set virtualServer = CreateObject("VirtualServer.Application")

'Get collection of virtual machines
set vmCollection = virtualServer.VirtualMachines

'Iterate over the virtual machines and display data
For Each vm in vmCollection
Wscript.Echo "=============================="
Wscript.Echo "Name: " & vm.Name
Wscript.Echo
Wscript.Echo "Notes: " & vm.Notes

Wscript.Echo "=============================="

Next

'Script Ends

Works Fine

PHP Script

<?php
f1();
function f1()
{
//Connect to Virtual Server
$virtualServer = new COM("VirtualServer.Application");

//Get collection of virtual machines
$vmCollection = $virtualServer->VirtualMachines;
//Iterate over the virtual machines and display data
foreach( $vmCollection as $vm)
{
print("\n==============================");
print( "\nName: " $vm->Name);
print("\n==============================");
}
}


Expected result:
----------------
The Virtual Server objected created

Actual result:
--------------
Throughs Run time ERROR:
Fatal error: Uncaught exception 'com_exception' with message 'Source:
Unknown
Description: Unknown' in C:\Program Files\lxlabs\ext\php\test.php:9
Stack trace:
#0 C:\Program Files\lxlabs\ext\php\test.php(9): f1()
#1 C:\Program Files\lxlabs\ext\php\test.php(2): f1()
#2 {main}
thrown in C:\Program Files\lxlabs\ext\php\test.php on line 9

When i cought Exception it will tough Object #2

please help me it's urgent



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


--
Edit this bug report at [url]http://bugs.php.net/?id=38840&edit=1[/url]