|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18393 COM Server with spaces in path cannot be instantiated
Submitted: 2002-07-17 09:58 UTC Modified: 2002-07-18 06:23 UTC
From: colin dot millar at unitech dot net Assigned:
Status: Not a bug Package: COM related
PHP Version: 4.2.1 OS: Windows 2000 Professional SP2
Private report: No CVE-ID: None
 [2002-07-17 09:58 UTC] colin dot millar at unitech dot net
Trying to instantiate an object in an out of process COM Server, where the COM Server located on a directory path that contains spaces causes an Access Violation and fails to instantiate the object.

Example code:

$conn = new COM('SMSHost.ConnectorObject');

Example setup 1:

1. COM Server is called 'SMSHost.exe'
2. COM Server contains single object called 'ConnectorObject'
3. Path to COM Server is 'c:\new folder' (note space in folder name)

In this case, a call to instantiate the COM Server with the example code above will lead to an Access Violation message.

Example setup 2:

1. and 2. are as above
3. Path to COM Server is 'c:\newfolder' (note no spaces in folder name)

In this case a call to instantiate the COM Server with the example code above works perfectly.

Additional Notes:

1. COM Server was created using Borland Delphi 6, and works with C# under .NET, Perl, JScript, and VBScript (tested on all of these platforms).

2. Though the documentation doesn't mention it, in process COM Servers do not appear to work at all with PHP. In process (DLL) COM Servers can have their objects instantiated, but any method calls lead to error "Access Violation". Whilst I would classify this as a separate bug to the above, I thought it best to mention it here in case it is related.

Best of luck, and please feel free to contact me should you need futher information.


Colin Millar


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-17 11:35 UTC]
 [2002-07-17 18:21 UTC]
can you instanciate the server in the path containing whitespaces from within the other languages you mentioned ?
i remember that i read something about this in an msdn article, but i don't remember the reason/solution.
i can't imagine that this is php related because all we do is call CoCreateInstance() passing the progid without knowing where the server is located (it even can be on another machine), so this seems more like a windows bug, but it would be curious then if it works with the other languages you mentioned. that could only mean they are using other api functions, we could look that up in the case of Perl then.

regarding you second issue i don't have an answer either. inproc servers are supposed to work (most of the components provided with windows are inproc servers, like adodb). can you give me a specific example ?
and please open a seperate bugreport for this, as i don't think that these two are related beside the possibility of a misconfigured win2k installation.

 [2002-07-18 06:23 UTC] colin dot millar at unitech dot net
OK - I've had a further look into this. I now think that it is a permissions related problem. Three developments are significant:

1. Running the PHP script which uses the COM object from a command prompt works with no problems.
2. Running the PHP script as a web page (i.e. as normal) is fine, provided step 1 above has been executed. If step 1 above has not been executed, then I get the error every time. Furthermore, if I first of all run a Perl script from the command line that references the object, then the PHP script runs fine too. The problem only seems to occur when instantiating the object for the first time using the web server's security credentials.
3. The 'Space in COM Server path' problem is a red herring. Spaces don't make any difference. It just seemed as though they did.

I think that the problem may be that the first time the COM object is instantiated, it carries out some operation that it cannot do due to lack of permissions when instanitated under the web server's credentials.

This may be a Delphi problem - Delphi 6 Pro was used to create the COM Server, and the COM Server was registered using the standard 'comserver.exe /regserver' command. It seems as though some additional setup goes on the first time the COM Server is instantiated, other than the registration of the server.

I'm afraid also that I misreported the error message as an Access Violation. The correct error reported is 'The exception Unknown Software Exception (0x0eedfade) occurred in the application at location 0x77e989d1'.

I've marked this bug as 'Bogus' now as I think it is not a PHP problem, but either a Delphi or Windows problem.

I'll look further into the in proc COM server problem, and add a bug report for that as well, after a bit more thought.

Many thanks,

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 13:01:30 2024 UTC