| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2006-06-14 23:30 UTC] rrichards@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 11:00:01 2025 UTC | 
Description: ------------ Tricky bug: if you run the example, you get a segmentation fault. If you change the line: $Data = $body->appendChild( $dom->createElement( 'Data', '123' ) ); to $Data = $body->appendChild( $dom->createElement( 'Data', '1234' ) ); The script executes as expected. It seems that as long as the data in the field is 4 characters or more, everything runs as expected. However, if the data is less then 4 characters, attempting to change it causes a segmentation fault, every time. I've tried this code and get the error with versions 5.1.3, 5.1.4 and the 6/14/2006 snapshot of 6.0.0. Reproduce code: --------------- <?php // Create some XML $dom = new DOMDocument('1.0'); $dom->formatOutput = true; $body = $dom->appendChild( $dom->createElement( 'Body' ) ); $Data = $body->appendChild( $dom->createElement( 'Data', '123' ) ); $dom->save( 'Data.xml' ); // Atempt to load and change XML file $NewDOM = new DOMDocument('1.0'); $NewDOM->load( 'Data.xml' ); $Data = $NewDOM->getElementsByTagName( 'Data' )->item( 0 ); $Data->firstChild->data = 2; $NewDOM->save( 'Data.xml' ); ?> Expected result: ---------------- Data.xml should be: <?xml version="1.0"?> <Body> <Data>2</Data> </Body> Actual result: -------------- Segmentation fault