|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-04-28 15:37 UTC] cb at designassembly dot de
System: Apache/1.3.24 PHP running as SAPI-module (Binary from php.net)
simple script, which causes segfault
<?
$doc = new_xmldoc( "1.0" );
$root = $doc->add_root("document");
for($i = 1; $i < 1000; $i++){
$element = $doc->create_element("element");
$element->set_content("content ".$i);
$root->append_child($element);
}
$xml = $doc->dumpmem();
echo htmlspecialchars($xml);
?>
Description:
the content is shown shortly in the browser, but apache causes a segfault in module php4ts.dll at offset 00096057 and finally a 404 page is displayed.
This code causes no problems with PHP 4.1.2. When you try to create only 100 elements in this loop, it runs without any seg-faults. For complex xmldocuments this bug makes it impossible to use domxml with php 4.2.
Modules:
php_domxml, php_xslt, php_gd und mysql
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 22:00:01 2025 UTC |
even with the new php_domxml.dll it still crashes also when you use the correct new function append_sibling() it still crashes, even worser when you forget to add content to your nodes as in the example above apache crashes in a loop until the timeout is reached and no output reaches the browser. <? $doc = domxml_new_doc("1.0"); $root = $doc->create_element("HTML"); $root = $doc->append_child($root); $body = $doc->create_element("element"); $body = $root->append_child($body); //$body->set_content("content"); for($i = 1; $i < 130; $i++){ $element = $doc->create_element("element"); //$element->set_content("content ".$i); $body->append_sibling($element); } echo htmlentities($doc->dump_mem(true)); ?>GREAT ! I was sufferring (the same ) bug using the latest PHP binaries with: $dom = domxml_open_file("tests/huge.xml"); $array = $dom->get_elements_by_tagname('document'); foreach($array as $e) { echo "<br>" . $e->get_attribute("id"); } using 'php4-win32-STABLE-latest.zip' its works !! many thanks