#33305 [NEW]: appendChild adds additionnal namespace on wrong node
From: francois dot proulx at gmail dot com
Operating system: Linux Mandrake 10.1
PHP version: 5.0.4
PHP Bug Type: *XML functions
Bug description: appendChild adds additionnal namespace on wrong node
Description:
------------
When adding a node with a different namespace on the second or third level
of a DOM tree. DOM adds additionnal namespace declaration to the upper
levels where it shoul'nt.
I'm using libxml 2.6.17 or 2.6.19 (same issue). DOM/XML API Version
20031129.
Reproduce code:
---------------
$document = new DomDocument();
$root = $document->createElementNS(OAI_PMH_NS, "OAI-PMH");
$document->appendChild($root);
$get_record_node = $document->createElementNS(OAI_PMH_NS, "GetRecord");
$record_node = $document->createElementNS(OAI_PMH_NS, "record");
$metadata_node = $document->createElementNS(OAI_PMH_NS, "metadata");
$node_bug = $document->createElementNS(LOM_EXPORT_NS, "lom_prefix:lom");
$record_node->appendChild($metadata_node);
$metadata_node->appendChild($node_bug);
$get_record_node->appendChild($record_node);
$root->appendChild($get_record_node);
Expected result:
----------------
<?xml version="1.0"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/">
<GetRecord>
<record>
<metadata>
<lom_prefix:lom xmlns:lom_prefix="http://ltsc.ieee.org/xsd/LOM"/>
</metadata>
</record>
</GetRecord>
</OAI-PMH>
Actual result:
--------------
<?xml version="1.0"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/">
<GetRecord xmlns:lom_prefix="http://ltsc.ieee.org/xsd/LOM">
<record xmlns:lom_prefix="http://ltsc.ieee.org/xsd/LOM">
<metadata>
<lom_prefix:lom xmlns:lom_prefix="http://ltsc.ieee.org/xsd/LOM"/>
</metadata>
</record>
</GetRecord>
</OAI-PMH>
--
Edit bug report at http://bugs.php.net/?id=33305&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33305&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33305&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33305&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33305&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33305&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33305&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33305&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33305&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33305&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33305&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33305&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33305&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33305&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33305&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33305&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33305&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33305&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33305&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33305&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33305&r=mysqlcfg
Thread (3 messages)
- francois dot proulx at gmail dot com