Bug #52661 [Fbk->NoF]: lookupNamespaceURI returns nothing
| From: | php-bugs at lists dot php dot net | Date: | Mon, 18 Feb 2013 00:34:26 +0000 |
| Subject: | Bug #52661 [Fbk->NoF]: lookupNamespaceURI returns nothing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176893@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52661&edit=1
ID: 52661
Updated by: php-bugs@lists.php.net
Reported by: tim at buyplaytix dot com
Summary: lookupNamespaceURI returns nothing
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: DOM XML related
Operating System: Ubuntu maverick
PHP Version: 5.3.3
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2010-08-20 21:24:46] rrichards@php.net
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
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=52661&edit=1