|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-08-20 21:24 UTC] rrichards@php.net
-Status: Open
+Status: Feedback
[2010-08-20 21:24 UTC] rrichards@php.net
[2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
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.