cvs: php4 /ext/domxml php_domxml.c

From: Date: Thu, 20 Mar 2003 09:48:30 +0000
Subject: cvs: php4 /ext/domxml php_domxml.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-19706@lists.php.net to get a copy of this message
chregu Thu Mar 20 04:48:30 2003 EDT Modified files: /php4/ext/domxml php_domxml.c Log: fix for bug #22786 ("Crash when trying to call DomAttribute's set_namespace method") Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.240 php4/ext/domxml/php_domxml.c:1.241 --- php4/ext/domxml/php_domxml.c:1.240 Wed Mar 19 20:27:40 2003 +++ php4/ext/domxml/php_domxml.c Thu Mar 20 04:48:19 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.c,v 1.240 2003/03/20 01:27:40 sniper Exp $ */ +/* $Id: php_domxml.c,v 1.241 2003/03/20 09:48:19 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -3352,7 +3352,11 @@ /* if node is in a document, search for an already existing namespace */ if (nodep->doc != NULL) { - nsptr = xmlSearchNsByHref(nodep->doc, nodep, (xmlChar*) uri); + if (nodep->type == XML_ATTRIBUTE_NODE) { + nsptr = xmlSearchNsByHref(nodep->doc, nodep->parent, (xmlChar*) uri); + } else { + nsptr = xmlSearchNsByHref(nodep->doc, nodep, (xmlChar*) uri); + } } else { nsptr = NULL; } @@ -3367,9 +3371,13 @@ sprintf(prefixtmp, "a%d", random); prefix = prefixtmp; } - nsptr = xmlNewNs(nodep, uri, prefix); + if (nodep->type == XML_ATTRIBUTE_NODE) { + nsptr = xmlNewNs(nodep->parent, uri, prefix); + } else { + nsptr = xmlNewNs(nodep, uri, prefix); + } } - + xmlSetNs(nodep, nsptr); } /* }}} */

« previous php.cvs (#19706) next »