|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19156 Instanced COM-Ojects won't terminate if accessing array-properties
Submitted: 2002-08-28 12:31 UTC Modified: 2002-10-02 08:02 UTC
Avg. Score:4.2 ± 0.7
Reproduced:4 of 5 (80.0%)
Same Version:2 (50.0%)
Same OS:2 (50.0%)
From: dwt at myrealbox dot com Assigned:
Status: Closed Package: COM related
PHP Version: 4.2.2 OS: Windows XP
Private report: No CVE-ID:
 [2002-08-28 12:31 UTC] dwt at myrealbox dot com
When writing applications instancing COM objects I always faced the problem of the instanced program not terminating correctly although everything else worked fine. In fact the process had to be killed manually by using the task manager. Browsing some messageboards I found out I was not the only one and began to investigate the problem. I finally was able to isolate the cause for this peculiar behaviour to be illustrated by the sample code below:


//Accessing arrays by retrieving elements via function ArrayName(Index) works, but certainly is neither efficient nor good style
$excel=new COM("Excel.Application");




//Accessing arrays as usual (using the [] operator) works, buts leads to the application not being able to terminate by itself
$excel=new COM("Excel.Application");




The sample code performs the same action twice and each time the file is properly created. Yet for some mysterious reason the instanced excel process won't terminate once you've accessed an array the way most programmers (especially those who do a lot of oop in c++) do!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-28 12:38 UTC] dwt at myrealbox dot com
I forgot to provide the following data:
I'm using PHP as a module for Apache 1.3.26 win32.
The sample code was tested using OfficeXP.
 [2002-09-19 09:30 UTC] jadair at adairservices dot net
OS: W2K Pro
With PHP 4.2.2 & 4.2.3 it appears that accessing array-properties has a devastating effect, it will crash Apache, at least on my machine.

PHP 4.1.2a does not crash, but does not terminate the COM-Objects as noted.

The workaround does work.
 [2002-10-02 08:02 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Dec 01 18:01:33 2015 UTC