ID: 37809 Updated by: [EMAIL PROTECTED] Reported By: phpbug at drque dot net -Status: Open +Status: Bogus Bug Type: XML related Operating System: Linux; Debian kernel 2.6.8-3-k7 PHP Version: 5.1.4 New Comment:
This appears to be a libxml bug that has been fixed in newer releases. Either use a newer version (.21 or later) or as a workaround remove text node and append a new one with new value (or just replaceChild). Previous Comments: ------------------------------------------------------------------------ [2006-06-14 21:30:18] phpbug at drque dot net 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37809&edit=1