[xml] xmlGetNodePath() returns invalid path for XML_DTD_NODE



Hi all,

I'm forwarding this from <https://bugs.php.net/80680>, because I think
it is a libxml2 issue.

The problem is that calling xmlGetNodePath() on an XML_DTD_NODE returns
"/?", which is to my knowledge an invalid XPath expression.  Instead, if
I'm not mistaken, the function should return NULL instead.


 tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tree.c b/tree.c
index 08b1a50..fe1f701 100644
--- a/tree.c
+++ b/tree.c
@@ -4684,7 +4684,8 @@ xmlGetNodePath(const xmlNode *node)
     char nametemp[100];
     int occur = 0, generic;

-    if ((node == NULL) || (node->type == XML_NAMESPACE_DECL))
+    if ((node == NULL) || (node->type == XML_NAMESPACE_DECL)
+        || (node->type == XML_DTD_NODE))
         return (NULL);

     buf_len = 500;


Regards,
Christoph



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]