|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-12-24 07:55 UTC] vodmal at newmail dot 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>");
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 18:00:01 2025 UTC |
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.