Bug #69168 [NEW]: DomNode::getNodePath() returns invalid path
From: juha dot ikavalko at agentit dot fi
Operating system: Linux, Debian
PHP version: Irrelevant
Package: XSLT related
Bug Type: Bug
Bug description:DomNode::getNodePath() returns invalid path
Description:
------------
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
<allusers><user><uid>bob</uid></user><user><uid>joe</uid></user></allusers>
EOB;
$xsl = <<<EOB
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl">
<xsl:template match="allusers">
<xsl:for-each select="user">
<xsl:value-of select="php:function('getPath',uid)"/><br />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
EOB;
function getPath($input){
return $input[0]->getNodePath() . ' = ' . $input[0]->nodeValue;
}
$proc = new XSLTProcessor();
$proc->registerPHPFunctions();
@$proc->importStyleSheet(DOMDocument::loadXML($xsl));
echo @$proc->transformToXML(DOMDocument::loadXML($xml));
Expected result:
----------------
/allusers/user[1]/uid = bob
/allusers/user[2]/uid = joe
Actual result:
--------------
/uid = bob
/uid = joe
--
Edit bug report at https://bugs.php.net/bug.php?id=69168&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69168&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69168&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69168&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69168&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69168&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69168&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69168&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69168&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69168&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69168&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69168&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69168&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69168&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69168&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69168&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69168&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69168&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69168&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69168&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69168&r=mysqlcfg
Thread (3 messages)
- juha dot ikavalko at agentit dot fi