#21489 [Com]: Excel hangs after creation via COM

2003-01-08 Thread php_general
 ID:   21489
 Comment by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: COM related
 Operating System: Win 2K Server
 PHP Version:  4.3.0
 New Comment:

I see this behaviour on 4.2.3 but not with 4.3.0 on Win2Kpro SP3 Apache
1.3.27 (PHP running as module).
On 4.2.3 the same Excel.exe is reused each time I run a
script very similar to this one. I end up with one Excel.exe left in
taskmanager after running this script "1 to n" times.
In 4.3.0 Excel.exe appears for a moment while the script runs then
disappears.

I get exactly the same behaviour on Win2k server SP2.


Previous Comments:


[2003-01-07 07:52:30] [EMAIL PROTECTED]

This is the code I always used with PHP prior to 4.2.X and 4.3.0:
function ExcelSheet($filein,$tmpdir) {

   $fileout = substr(tempnam($tmpdir, "tmp"), 0, -4);
   $ex = new COM("Excel.sheet") or Die ("Cannot find excel!");
   $ex->Application->Visible = 0;
   $wkb = $ex->Application->Workbooks->Open($filein) or Die ("Cannot
open excel!");
   $ex->Application->ActiveWorkbook->SaveAs($fileout, -4143);
   $ex->application->ActiveWorkbook->Close("False");
   unset($ex);
   return($fileout . ".xls");
}

The excel function works, but afterwards the excel process remains in
memory, as other people have already argued.






-- 
Edit this bug report at http://bugs.php.net/?id=21489&edit=1




#21172 [Com]: PHP crashed when try to access XML DOM COM interfaces

2003-01-08 Thread php_general
 ID:   21172
 Comment by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: COM related
 Operating System: Windows 2000
 PHP Version:  4.2.1
 New Comment:

Tried this on Win2KPro SP3, Apache 1.3.27, PHP 4.2.3 and
PHP 4.3.0 (both as module) and get the crash on same line.
Actually as soon as I reference $attr->Name eg
$tmpStr = $attr->Name; // crashes
but if I remove the $attr->Name; line then the
echo($node->nodeName." ".$node->xml."");
loop works OK.

I am also experiencing crashes when I generate Excel
spreadsheets with 4.3.0. My code generally works fine
under 4.2.3 (except that an excel process is left running
after each time the code is run).
The following seems to be a minimal test case;

\n";
$excel = new COM("Excel.Application") or die("Excel could not be
started");

$workbook = "c:\\tmp\\in.xls";// can just be an empty wookbook
$wkb = $excel->application->Workbooks->Open($workbook) or Die ("Did not
open");

$sheet = $wkb->Worksheets(1);
$sheet->activate;
$sheet->name='Testing 123'; 

$y=6;
for($i=0;$i<6;$i++){
  $cell = $sheet->Cells($y+$i,1); // Select the cell (Row Column
number) 
  $cell->activate; // Activate the cell 
  $cell->value = 'JimBob';
  $cell = $sheet->Cells($y+$i,2);
  $cell->activate;
  $cell->value = 'Yer Baby';
}

$file_name='c:/tmp/adtdump.xls';
if (file_exists($file_name)) {unlink($file_name);} 
$wkb->SaveAs($file_name);
$wkb->Close();

// close the application
$excel->Workbooks->Close();
$excel->ActiveWorkbook->Close("False");
$excel->Quit();
$excel->Release();
$excel = null;
unset($excel); 
?>

If the for loop has $i < 1 then the test will fault one in around five
times.
Fault window is;
Microsoft Excel: EXCEL.EXE - Application Error
The instruction at "0x30033ddf" referenced memory at 0x660667f8.
The memory could not be "read".

With $i<10 is faults every time.
and is then usually followed by an Apache Ap error and
Apache restarts the child process (and uptime goes back
 to 0).
With $i<6 it faults most of the time but I haven't seen
an Apache Ap error after the Excel.exe one.

Each time it faults I get an Excel.exe left in taskmanager. If it runs
without faulting then I don't.


Previous Comments:


[2002-12-26 01:57:49] [EMAIL PROTECTED]

Latest PHP build don't solve this porblem :-\

I am use PHP for Win32 as CGI, may be this information can help fix
this problem.
DOM XML -> Microsoft XML Parser 4.? (latest)



[2002-12-24 17:52:54] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip





[2002-12-24 07:55:40] [EMAIL PROTECTED]

test.xml:



aa
bb
nn


test.php:
load("D:\\Inetpub\\wwwroot\\vphpmail\\test.xml"))
{
$nodeList = $MSXML->getElementsByTagName("v");
for ($i=0;$i<$nodeList->length;$i++)
{
$node = $nodeList->nextNode();
$attribs = $node->attributes;
$attr = $attribs->getNamedItem("val");

echo($attr->Name."");   // This is crash

echo($node->nodeName." ".$node->xml."");
}
}
else
{
echo("BAD");
echo(
"Error in file ".$MSXML->parseError->url." at line 
".
$MSXML->parseError->line." in pos
".$MSXML->parseError->linepos."");
}
?>




-- 
Edit this bug report at http://bugs.php.net/?id=21172&edit=1