|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69168 DomNode::getNodePath() returns invalid path
Submitted: 2015-03-03 10:09 UTC Modified: 2021-09-20 12:46 UTC
From: juha dot ikavalko at agentit dot fi Assigned:
Status: Verified Package: XSLT related
PHP Version: 7.4 OS: Linux, Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: juha dot ikavalko at agentit dot fi
New email:
PHP Version: OS:


 [2015-03-03 10:09 UTC] juha dot ikavalko at agentit dot fi
DomNode::getNodePath() returns invalid output when node is passed to php function from XSLT.

php 5.6.4  - doesn't work
php 5.5.19 - doesn't work
php 5.4.35 - doesn't work
php 5.4.10 - OK
php 5.4.4  - OK
php 5.3.3  - OK
php 5.2    - OK

Test script:
$xml = <<<EOB
$xsl = <<<EOB
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="" xmlns:php="">
 <xsl:template match="allusers">
    <xsl:for-each select="user">
      <xsl:value-of select="php:function('getPath',uid)"/><br />

function getPath($input){
  return $input[0]->getNodePath() . ' = ' . $input[0]->nodeValue;

$proc = new XSLTProcessor();
echo @$proc->transformToXML(DOMDocument::loadXML($xml));

Expected result:
/allusers/user[1]/uid = bob
/allusers/user[2]/uid = joe

Actual result:
/uid = bob
/uid = joe


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-20 12:46 UTC]
-Status: Open +Status: Verified -PHP Version: Irrelevant +PHP Version: 7.4
 [2021-09-20 12:46 UTC]
I can confirm the erroneous behavior with PHP-7.4 and libxml2
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Sep 22 06:23:17 2021 UTC