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

From: Date: Thu, 09 Jan 2003 02:36:49 +0000
Subject: #21172 [Com]: PHP crashed when try to access XML DOM COM interfaces
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29517@lists.php.net to get a copy of this message
ID: 21172 Comment by: php_general@e1da.net Reported By: vodmal@newmail.ru 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."<BR>"); 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; <?php echo "Test started...<br/>\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] vodmal@newmail.ru 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] iliaa@php.net 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] vodmal@newmail.ru test.xml: <?xml version="1.0"?> <test a="g" b="false"> <v val="1">aa</v> <v val="2">bb</v> <v val="3">nn</v> </test> test.php: <? $MSXML = new COM("Msxml2.DOMDocument"); if ($MSXML->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."<BR>"); // This is crash echo($node->nodeName." ".$node->xml."<BR>"); } } else { echo("BAD<br>"); echo( "Error in file <b>".$MSXML->parseError->url."</B> at line <b>". $MSXML->parseError->line."</b> in pos <b>".$MSXML->parseError->linepos."</b>"); } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21172&edit=1

« previous php.bugs (#29517) next »