From: goetas at lignano dot it Operating system: ubuntu 12.04 PHP version: 5.4.17 Package: DOM XML related Bug Type: Bug Bug description:DOMXPath query registerNodeNS produces unexpected behavior
Description: ------------ registerNodeNS option (default to true) added with php 5.3.3 produces unexpected behavior and BC issue. $registerNodeNS = true seems to remove (overwrite) registered namespaces with DOMXPath::registerNamespace() method, Similar problem has been reported with #55700 Test script: --------------- <?php $dom = new DOMDocument('1.0', 'UTF-8'); $dom->loadXML(' <ns1:tag xmlns:ns1="http://my.com/ns1" xmlns:ns2="http://my.com/ns2"> <ns1:tag-2/> <ns2:extra/> </ns1:tag>'); $xpath = new DOMXPath($dom); $xpath->registerNamespace("ns2", "http://my.com/ns1"); echo $xpath->query("//ns2:tag-2", null, false)->length."\n"; echo $xpath->query("//ns2:tag-2", null, true)->length,"\n"; /* * registerNodeNS option should skip prefix registration if * same prefix is already registered with registerNamespace() method. */ Expected result: ---------------- 1 1 Actual result: -------------- 1 0 -- Edit bug report at https://bugs.php.net/bug.php?id=65375&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65375&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65375&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65375&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65375&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65375&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65375&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65375&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65375&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65375&r=support Expected behavior: https://bugs.php.net/fix.php?id=65375&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65375&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65375&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65375&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65375&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65375&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65375&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65375&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65375&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65375&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65375&r=mysqlcfg