From: phpbug at drque dot net Operating system: Linux; Debian kernel 2.6.8-3-k7 PHP version: 5.1.4 PHP Bug Type: XML related Bug description: DOM Segmentation fault when changing "firstChild->data"
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 bug report at http://bugs.php.net/?id=37809&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37809&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37809&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37809&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37809&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37809&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37809&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37809&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37809&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37809&r=support Expected behavior: http://bugs.php.net/fix.php?id=37809&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37809&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37809&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37809&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37809&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37809&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37809&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37809&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37809&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37809&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37809&r=mysqlcfg