From: olav dot morken at uninett dot no Operating system: Linux (Debian) PHP version: 5.3.0 PHP Bug Type: DOM XML related Bug description: XPath namespace prefix conflict
Description: ------------ When processing an XML document with namespaces, an XPath query for a node with a different namespace but the same namespace prefix fails. This appears to be a conflict between the XPath namespaces and the document namespaces. It works if either: - The prefix in the query is replaced with a prefix that doesn't exist in the document. - If the prefix in the query matches the prefix in the document. This was tested with: - PHP 5.3 from debian experimental: 5.3.0-3 - libxml2 2.7.3.dfsg-2.1 Reproduce code: --------------- $doc = new DOMDocument(); $doc->loadXML('<prefix:root xmlns:prefix="urn:a" />'); $xp = new DOMXPath($doc); $xp->registerNamespace('prefix', 'urn:b'); echo($xp->query('//prefix:root')->length . "\n"); Expected result: ---------------- It should not find the root node, since we ask for a node in a different prefix. I.e. it should print '0'. Actual result: -------------- It finds the root node, i.e. it prints '1'. -- Edit bug report at http://bugs.php.net/?id=49490&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49490&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49490&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49490&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49490&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49490&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49490&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49490&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49490&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49490&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49490&r=support Expected behavior: http://bugs.php.net/fix.php?id=49490&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49490&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49490&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49490&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49490&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49490&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49490&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49490&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49490&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49490&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49490&r=mysqlcfg