|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-08-06 13:48 UTC] jtate@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 18:00:02 2025 UTC |
Following script will allow you to reproduce the bug. The script doesn't crash when we add 100 nodes but it crashes for a bigger (500) number of nodes. It seesms like it finishes executing all the statements and crashes after the last one. <?php $xmlString = GetBaseAppXML(); if( !$xmlDoc = domxml_open_mem( $xmlString ) ) { echo "Error while creating DOM object\n"; exit; } for ( $i=0; $i<500; $i++ ) { UpdateAppXML( $xmlDoc, $i, "This" ); } echo( $xmlDoc->dump_mem( true )); exit; function GetBaseAppXML() { $strXML = '<?xml version="1.0" ?>'; $strXML = $strXML.'<XMLPage>'; $strXML = $strXML.'</XMLPage>'; return $strXML; } function UpdateAppXML( &$xmlDoc, $key, $value ) { $searchStr = "//SET[@VARNAME = '".$key."']" ; $xpathCtx = xpath_new_context( $xmlDoc ); $arrSetElem = xpath_eval( $xpathCtx, $searchStr ); $setElem = $arrSetElem->nodeset[0]; if ( is_object( $setElem ) ) { $setElem->set_attribute( "VALUE", $value ); } else { $searchStr = "/XMLPage" ; $rootElem = $xmlDoc->document_element(); if ( $rootElem != null ) { $newElem = $xmlDoc->create_element( "SET" ); $newElem->set_attribute( "VARNAME", $key ); $newElem->set_attribute( "VALUE", $value ); $newElem = $rootElem->append_child( $newElem ); unset( $newElem ); } else { $strMsg = "UpdateAppXML :: Failed to get ROOT element in file: ".$appFilePath ; print( "Error processing request<BR>" ); print( $strMsg ); unset( $strMsg ); } unset( $rootElem ); } unset( $xpathCtx ); unset( $arrSetElem ); unset( $setElem ); } ?>