diff options
| author | Rob Richards <rrichards@php.net> | 2007-07-10 12:24:51 +0000 |
|---|---|---|
| committer | Rob Richards <rrichards@php.net> | 2007-07-10 12:24:51 +0000 |
| commit | 796d9cd7839bbd86740330200f4095ca05695019 (patch) | |
| tree | 98c719be9755614fbf0f3897e88036bb4b39f0de /ext/simplexml/simplexml.c | |
| parent | 510bee631fe56ec86d2ebd6531df81fad7d3872a (diff) | |
| download | php-git-796d9cd7839bbd86740330200f4095ca05695019.tar.gz | |
fix bug #41947 (SimpleXML incorrectly registers empty strings as namespaces
add test
Diffstat (limited to 'ext/simplexml/simplexml.c')
| -rw-r--r-- | ext/simplexml/simplexml.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index c6e2358cc5..d480497738 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1571,11 +1571,16 @@ SXE_METHOD(addChild) 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); |
