#19266 [Ana->Csd]: Segfault on append_child()

From: Date: Mon, 09 Sep 2002 20:22:39 +0000
Subject: #19266 [Ana->Csd]: Segfault on append_child()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18851@lists.php.net to get a copy of this message
ID: 19266 Updated by: chregu@php.net Reported By: pavlomr@hotmail.com -Status: Analyzed +Status: Closed Bug Type: DOM XML related Operating System: SuSE Linux 7.3 PHP Version: 4CVS-2002-09-06 Assigned To: chregu New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2002-09-09 15:03:57] chregu@php.net Hi checked with the W3-DOM standard (http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247). It's forbidden, what you are trying to do: "WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node." I'll write a check into the method, so that it doesn't segfault, but return an error chregu ------------------------------------------------------------------------ [2002-09-09 14:58:03] chregu@php.net Hi yep, this segfaults... but, you shouldn't append nodes from one document to another document for the time being. But you can use: $r1->append_child($r2->clone_node(1)); which works fine on my system chregu ------------------------------------------------------------------------ [2002-09-06 10:17:23] pavlomr@hotmail.com This bug corelates with #18197 Prehistory: libxml-1.8.15, libxml2-2.4.23 './configure' \ '--prefix=/usr/share' \ '--datadir=/usr/share/php' \ '--bindir=/usr/bin' \ '--libdir=/usr/share' \ '--with-config-file-path=/etc' \ '--with-exec-dir=/usr/lib/php/bin' \ '--with-mysql=/usr' \ '--with-informix' \ '--with-gd=yes' \ '--enable-gd-native-ttf' \ '--enable-gd-imgstrttf' \ '--with-tiff-dir=/usr' \ '--with-jpeg-dir=/usr' \ '--with-png-dir=/usr' \ '--with-xpm-dir=/usr/X11R6' \ '--with-ldap=yes' \ '--with-zlib' \ '--with-zlib-dir' \ '--with-bz2' \ '--with-gmp' \ '--with-xml' \ '--with-xmlrpc' \ '--with-xslt-sablot' \ '--with-expat-dir=/usr' \ '--with-dom' \ '--with-dom-xslt' \ '--with-dom-exslt' \ '--with-ttf' \ '--with-t1lib' \ '--with-mcal=/usr' \ '--with-imap=yes' \ '--with-sablot' \ '--with-sablot-js' \ '--with-readline' \ '--with-ftp' \ '--with-ndbm' \ '--with-gdbm' \ '--with-mcrypt' \ '--with-gettext' \ '--with-mm' \ '--with-gd=yes' \ '--with-qtdom=/usr/lib/qt2' \ '--enable-versioning' \ '--enable-yp' \ '--enable-bcmath' \ '--enable-trans-sid' \ '--enable-inline-optimization' \ '--enable-track-vars' \ '--enable-magic-quotes' \ '--enable-safe-mode' \ '--enable-sockets' \ '--enable-sysvsem' \ '--enable-sysvshm' \ '--enable-shmop' \ '--enable-calendar' \ '--enable-mbstring' \ '--enable-mbstr-enc-trans' \ '--enable-exif' \ '--enable-ftp' \ '--enable-memory-limit' \ '--enable-wddx' \ '--enable-filepro' \ '--enable-dbase' \ '--enable-ctype' \ '--enable-force-cgi-redirect' \ '--enable-discard-path' \ '--enable-sigchild' \ '--with-openssl' \ '--with-imap-ssl' \ '--with-gd=yes' \ '--with-apxs=/usr/sbin/apxs' \ '--with-pgsql=/usr' \ '--with-snmp' \ '--with-iconv' \ '--with-iconv-dir' \ 'i686-suse-linux' \ "$@" script bug.php: <?php $x1="<?xml version='1.0' encoding='iso8859-1' ?> <root1 xml:lang='de' xmlns:xml='http://www.w3.org/XML/1998/namespace'> <node xml:lang='en'>1 EN node</node> <node xml:lang='de'>1 DE node</node> <node>1 Default node</node> </root1> "; $x2="<?xml version='1.0' encoding='iso8859-1' ?> <root2 xml:lang='en' xmlns:xml='http://www.w3.org/XML/1998/namespace'> <node xml:lang='en'>2 EN node</node> <node xml:lang='de'>2 DE node</node> <node> 2 Default node</node> </root2> "; $d1=domxml_open_mem($x1); $d2=domxml_open_mem($x2); $r1=$d1->document_element(); $r2=$d2->document_element(); $r1->append_child($r2); echo $d1->dump_mem(); ?> produce output: <?xml version="1.0" encoding="iso8859-1"?> <root1 xml:lang="de"> <node xml:lang="en">1 EN node</node> <node xml:lang="de">1 DE node</node> <node>1 Default node</node> <root2 xml:lang="en"> <node xml:lang="en">2 EN node</node> <node xml:lang="de">2 DE node</node> <node> 2 Default node</node> </root2></root1> Segmentation fault Script segfaults WITH AND WITHOUT xmlns:xml declaration ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19266&edit=1

« previous php.bugs (#18851) next »