cvs: php4 /ext/domxml php_domxml.c

From: Date: Mon, 21 Jan 2002 19:12:13 +0000
Subject: cvs: php4 /ext/domxml php_domxml.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9124@lists.php.net to get a copy of this message
zenderx Mon Jan 21 14:12:13 2002 EDT Modified files: /php4/ext/domxml php_domxml.c Log: - fixed bug caused by libxml2 in xpath_register_ns() - registered namespaces are now persistent Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.109 php4/ext/domxml/php_domxml.c:1.110 --- php4/ext/domxml/php_domxml.c:1.109 Sun Jan 20 09:40:59 2002 +++ php4/ext/domxml/php_domxml.c Mon Jan 21 14:12:00 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.c,v 1.109 2002/01/20 14:40:59 hholzgra Exp $ */ +/* $Id: php_domxml.c,v 1.110 2002/01/21 19:12:00 zenderx Exp $ */ /* TODO * - Support Notation Nodes @@ -3285,20 +3285,25 @@ { /* TODO: - - make the namespace registration persistent - now it dissapears each time xpath_eval is called - automagically register all namespaces when creating a new context */ int prefix_len, uri_len, result; xmlXPathContextPtr ctxp; - char *prefix, *uri; + char *prefix, *uri, *uri_static; zval *id; DOMXML_PARAM_FOUR(ctxp, id, le_xpathctxp, "ss", &prefix, &prefix_len, &uri, &uri_len); /* set the context node to NULL - what is a context node anyway? */ ctxp->node = NULL; - result = xmlXPathRegisterNs(ctxp, prefix, uri); + + /* + this is a hack - libxml2 doesn't copy the URI, it simply uses the string + given in the parameter - which is normally deallocated after the function + */ + uri_static = estrndup(uri, uri_len); + result = xmlXPathRegisterNs(ctxp, prefix, uri_static); if (0 == result) { RETURN_TRUE;

« previous php.cvs (#9124) next »