From: Operating system: Ubuntu maverick PHP version: 5.3.3 Package: DOM XML related Bug Type: Bug Bug description:lookupNamespaceURI returns nothing
Description: ------------ Hopefully this is something that's fairly easy to see in the code. Providing a full working code sample will be somewhat difficult. This seems to happen most frequently with nodes that have been removed from the dom and added back elsewhere. Basically if I call lookupNamespace on a node I'm getting nothing back. If I load the node into SimpleXML and call getNamespaces I'm getting the namespace as expected. The attached code is a workaround for the problem. Test script: --------------- private function get_namespace($node) { $node_namespace = $node->lookupNamespaceURI($node->prefix); if($node instanceof DomElement && $node_namespace == null && strpos($node->nodeName, ":") !== false) { // must be some sort of DOM bug. Look and see if we can figure it out from simplexml $sxe = simplexml_import_dom($node); $namespaces = $sxe->getNamespaces(); foreach($namespaces as $prefix => $namespace) { if(strpos($node->nodeName, $prefix . ":") == 0) { $node_namespace = $namespace; break; } } } return $nodeNamespace; } Expected result: ---------------- I expect that if I get into the body of the if statement that I will return a null $node_namespace. Preferably I'd never get into the if statement. -- Edit bug report at http://bugs.php.net/bug.php?id=52661&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52661&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52661&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52661&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52661&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52661&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52661&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52661&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52661&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52661&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52661&r=support Expected behavior: http://bugs.php.net/fix.php?id=52661&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52661&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52661&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52661&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52661&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52661&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52661&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52661&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52661&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52661&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52661&r=mysqlcfg