Edit report at http://bugs.php.net/bug.php?id=52661&edit=1
ID: 52661 Updated by: rricha...@php.net Reported by: tim at buyplaytix dot com Summary: lookupNamespaceURI returns nothing -Status: Open +Status: Feedback Type: Bug Package: DOM XML related Operating System: Ubuntu maverick PHP Version: 5.3.3 Block user comment: N New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. most likely its due to how you are removing and adding them back in. Need a reproducible script to determine if this is really a bug in DOM or not Previous Comments: ------------------------------------------------------------------------ [2010-08-20 20:07:34] tim at buyplaytix dot com 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 this bug report at http://bugs.php.net/bug.php?id=52661&edit=1