1--TEST-- 2Dom\Element::setAttributeNode(NS) in the same document 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom1 = Dom\HTMLDocument::createEmpty(); 9$container = $dom1->appendChild($dom1->createElement("container")); 10 11echo "--- Without namespace ---\n"; 12 13$attribute1 = $dom1->createAttribute("my-attribute"); 14$attribute1->value = "1"; 15$container->setAttributeNode($attribute1); 16var_dump($container->setAttributeNode($attribute1) === null); 17$attribute2 = $dom1->createAttribute("my-attribute"); 18$attribute2->value = "2"; 19var_dump($container->setAttributeNode($attribute2) === $attribute1); 20$attribute3 = $dom1->createAttributeNS("", "my-ATTRIBUTE"); 21$attribute3->value = "3"; 22var_dump($container->setAttributeNode($attribute3) === null); 23 24echo "--- With namespace ---\n"; 25 26$attribute4 = $dom1->createAttributeNS("urn:a", "my-attribute"); 27$attribute4->value = "4"; 28$container->setAttributeNode($attribute4); 29var_dump($container->setAttributeNode($attribute4) === null); 30$attribute5 = $dom1->createAttributeNS("urn:b", "my-attribute"); 31$attribute5->value = "5"; 32var_dump($container->setAttributeNodeNS($attribute5) === null); 33 34echo "--- Resulting document ---\n"; 35 36echo $dom1->saveHtml(), "\n"; 37 38?> 39--EXPECT-- 40--- Without namespace --- 41bool(true) 42bool(true) 43bool(true) 44--- With namespace --- 45bool(true) 46bool(true) 47--- Resulting document --- 48<container my-attribute="2" my-ATTRIBUTE="3" my-attribute="4" my-attribute="5"></container> 49