diff options
author | Rob Richards <rrichards@php.net> | 2009-12-03 20:19:38 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2009-12-03 20:19:38 +0000 |
commit | 44aea5ebbbea6abf521fb532b8f409ccfeca806b (patch) | |
tree | b15c7f799c6ec697150ca37b8dc8ed0bae365540 /ext/dom/document.c | |
parent | 13010b552b0af39f3cd2c2464a035a5170625515 (diff) | |
download | php-git-44aea5ebbbea6abf521fb532b8f409ccfeca806b.tar.gz |
fix bug #47848 (importNode doesn't preserve attribute namespaces)
add tests
Diffstat (limited to 'ext/dom/document.c')
-rw-r--r-- | ext/dom/document.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c index f7cc69e038..8f2f5482b3 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1205,7 +1205,18 @@ PHP_FUNCTION(dom_document_import_node) if (!retnodep) { RETURN_FALSE; } - + + if ((retnodep->type == XML_ATTRIBUTE_NODE) && (nodep->ns != NULL)) { + xmlNsPtr nsptr = NULL; + xmlNodePtr root = xmlDocGetRootElement(docp); + + nsptr = xmlSearchNsByHref (nodep->doc, root, nodep->ns->href); + if (nsptr == NULL) { + int errorcode; + nsptr = dom_get_ns(root, nodep->ns->href, &errorcode, nodep->ns->prefix); + } + xmlSetNs(retnodep, nsptr); + } } DOM_RET_OBJ(rv, (xmlNodePtr) retnodep, &ret, intern); |