cvs: php4(PHP_4_3) /ext/domxml php_domxml.c

From: Date: Thu, 20 Mar 2003 09:43:10 +0000
Subject: cvs: php4(PHP_4_3) /ext/domxml php_domxml.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-19705@lists.php.net to get a copy of this message
chregu Thu Mar 20 04:43:10 2003 EDT Modified files: (Branch: PHP_4_3) /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.218.2.11 php4/ext/domxml/php_domxml.c:1.218.2.12 --- php4/ext/domxml/php_domxml.c:1.218.2.11 Fri Mar 7 08:42:11 2003 +++ php4/ext/domxml/php_domxml.c Thu Mar 20 04:43:09 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.c,v 1.218.2.11 2003/03/07 13:42:11 ddhill Exp $ */ +/* $Id: php_domxml.c,v 1.218.2.12 2003/03/20 09:43:09 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -3339,7 +3339,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; } @@ -3354,9 +3358,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 (#19705) next »