|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-02-24 12:09 UTC] chregu@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 04:00:01 2025 UTC |
Description: ------------ If the namespace of the insertBefore()'d element equals that of its parent, it loses the xmlns attribute, so becomes unnamespaced:( ! Reproduce code: --------------- <?php $main= DOMDocument::loadXML('<?xml version="1.0"?><f2f:no-xmlns xmlns:f2f="http://friend2friend.net"/>'); $new= $main->createElement('new'); $new->setAttribute('xmlns', 'http://friend2friend.net'); echo 'Main document= '.$main->saveXML().chr(13); echo 'New element= '.$main->saveXML($new).chr(13).chr(13); $main->firstChild->insertBefore($new, $main->firstChild->firstChild); echo 'insertBefore() changes <new> into an unnamespaced node iff its NS matched the parent node :-( '.$main->saveXML(); ?> Expected result: ---------------- Shouldn't lose the namespace. i.e. <f2f:no-xmlns xmlns:f2f="http://friend2friend.net"><f2f:new/></f2f:no-xmlns> Actual result: -------------- Loses the NS: <f2f:no-xmlns xmlns:f2f="http://friend2friend.net"><new/></f2f:no-xmlns>