Son of a ....

Yep.  After splitting up the DisplayAlerts line into
two lines, (and putting in an unset($application))
Excel is no longer resident after the script exits.

Is temporary-object behaviour supposed to happen
in cases like $obj->another->func(), or is this
an unintended side-effect of something else?

Does PHP usually create temp-objects when referencing
$obj->another, or is that behaviour only part of 
the COM subsystem?

Sorry for asking questions that are probably obvious,
but i'm not really too familiar with the details
of PHP's object handling.

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -----Original Message-----
> From: Alan Brown [mailto:[EMAIL PROTECTED]]
> Subject: Re: [PHP-WIN] Excel not closing after using it via COM
> 
> There is a missing "Release" call in the COM code when 
> temporary objects are
> created for a construct such as
> 
> $excel->application->DisplayAlerts = False;
> 
> This is not as visible a problem with an inproc server as 
> with a localserver
> such as Excel.
> 
> It is fairly easy to work around this (until I get a real fix 
> into the base)
> by breaking it up thus:
> 
> $application = $excel->application;
> $application->DisplayAlerts = False;
> 
> This has to be done in two places in the example I saw. 
> However I note that
> if you put in a logic error such as this:
> $book = $workbooks->Open($file);
> $sheet = $books->Worksheets(1);
> 
> After the exception a copy of Excel is still left running. I 
> wiill look more
> at this over the weekend and test my Release() call on the 
> temporary object.
> It seems to work, but I fear that it will break something else....
> 
> Alan.

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to