rrichards Tue Jul 10 12:24:51 2007 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/simplexml/tests bug41947.phpt
Modified files:
/php-src/ext/simplexml simplexml.c
Log:
fix bug #41947 (SimpleXML incorrectly registers empty strings as namespaces
add test
http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.22.2.32&r2=1.151.2.22.2.33&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.32
php-src/ext/simplexml/simplexml.c:1.151.2.22.2.33
--- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.32 Wed Jul 4 05:05:57 2007
+++ php-src/ext/simplexml/simplexml.c Tue Jul 10 12:24:51 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c,v 1.151.2.22.2.32 2007/07/04 05:05:57 pollita Exp $ */
+/* $Id: simplexml.c,v 1.151.2.22.2.33 2007/07/10 12:24:51 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1571,11 +1571,16 @@
newnode = xmlNewChild(node, NULL, localname, (xmlChar *)value);
if (nsuri != NULL) {
- nsptr = xmlSearchNsByHref(node->doc, node, (xmlChar *)nsuri);
- if (nsptr == NULL) {
+ if (nsuri_len == 0) {
+ newnode->ns = NULL;
nsptr = xmlNewNs(newnode, (xmlChar *)nsuri, prefix);
+ } else {
+ nsptr = xmlSearchNsByHref(node->doc, node, (xmlChar
*)nsuri);
+ if (nsptr == NULL) {
+ nsptr = xmlNewNs(newnode, (xmlChar *)nsuri,
prefix);
+ }
+ newnode->ns = nsptr;
}
- newnode->ns = nsptr;
}
_node_as_zval(sxe, newnode, return_value, SXE_ITER_NONE, (char
*)localname, prefix, 0 TSRMLS_CC);
@@ -2430,7 +2435,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.32 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.33 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");
http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/tests/bug41947.phpt?view=markup&rev=1.1
Index: php-src/ext/simplexml/tests/bug41947.phpt
+++ php-src/ext/simplexml/tests/bug41947.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php