rrichards Wed Nov 29 08:51:36 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/simplexml simplexml.c /php-src/ext/simplexml/tests bug39662.phpt Log: correct fix for bug #39662 to fix leak and tree corruption fix test http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.22.2.16&r2=1.151.2.22.2.17&diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.16 php-src/ext/simplexml/simplexml.c:1.151.2.22.2.17 --- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.16 Tue Nov 28 18:59:52 2006 +++ php-src/ext/simplexml/simplexml.c Wed Nov 29 08:51:36 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.151.2.22.2.16 2006/11/28 18:59:52 tony2001 Exp $ */ +/* $Id: simplexml.c,v 1.151.2.22.2.17 2006/11/29 08:51:36 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1211,7 +1211,7 @@ node = php_sxe_get_first_node(sxe, node TSRMLS_CC); if (node) { - if (XML_DOCUMENT_NODE == node->parent->type) { + if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) { int bytes; bytes = xmlSaveFile(filename, (xmlDocPtr) sxe->document->ptr); if (bytes == -1) { @@ -1240,7 +1240,7 @@ node = php_sxe_get_first_node(sxe, node TSRMLS_CC); if (node) { - if (XML_DOCUMENT_NODE == node->parent->type) { + if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) { xmlDocDumpMemory((xmlDocPtr) sxe->document->ptr, &strval, &strval_len); RETVAL_STRINGL((char *)strval, strval_len, 1); xmlFree(strval); @@ -1762,7 +1762,6 @@ } if (sxe->node) { nodep = xmlDocCopyNode(sxe->node->node, docp, 1); - nodep->parent = sxe->node->node->parent; } php_libxml_increment_node_ptr((php_libxml_node_object *)clone, nodep, NULL TSRMLS_CC); @@ -2332,7 +2331,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "Simplexml support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.16 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.17 $"); php_info_print_table_row(2, "Schema support", #ifdef LIBXML_SCHEMAS_ENABLED "enabled"); http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/tests/bug39662.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/simplexml/tests/bug39662.phpt diff -u php-src/ext/simplexml/tests/bug39662.phpt:1.1.2.2 php-src/ext/simplexml/tests/bug39662.phpt:1.1.2.3 --- php-src/ext/simplexml/tests/bug39662.phpt:1.1.2.2 Tue Nov 28 18:59:53 2006 +++ php-src/ext/simplexml/tests/bug39662.phpt Wed Nov 29 08:51:36 2006 @@ -31,9 +31,7 @@ " } -string(55) "<?xml version="1.0" encoding="utf-8"?> -<test> +string(15) "<test> -</test> -" +</test>" Done
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php