1--TEST-- 2Element::getAttributeNS() 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = Dom\HTMLDocument::createFromString('<!DOCTYPE html><html><body align="foo" foo:bar="baz"></body></html>'); 9$body = $dom->getElementsByTagName("body")[0]; 10 11echo "--- After parsing, i.e. without namespace ---\n"; 12 13// Every pair of 2 calls should return the same result 14var_dump($body->getAttributeNS(NULL, "align")); 15var_dump($body->getAttributeNS("", "align")); 16var_dump($body->getAttributeNS(NULL, "ALIGN")); 17var_dump($body->getAttributeNS("", "ALIGN")); 18var_dump($body->getAttributeNS(NULL, "foo:bar")); 19var_dump($body->getAttributeNS("", "foo:bar")); 20var_dump($body->getAttributeNS(NULL, "FOO:BAR")); 21var_dump($body->getAttributeNS("", "FOO:BAR")); 22 23echo "--- Special legacy case ---\n"; 24 25var_dump($dom->documentElement->getAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns")); 26 27echo "--- Get after creating without namespace ---\n"; 28 29$body->setAttributeNode($attr = $dom->createAttribute("prefix:local")); 30$attr->value = "A"; 31var_dump($body->getAttributeNS(NULL, "prefix:local")); 32var_dump($body->getAttributeNS(NULL, "prefix:LOCAL")); 33 34echo "--- Get after creating with namespace ---\n"; 35 36$body->setAttributeNode($attr = $dom->createAttributeNS("urn:a", "prefix:local2")); 37$attr->value = "B"; 38var_dump($body->getAttributeNS("urn:a", "local2")); 39var_dump($body->getAttributeNS("urn:a", "LOCAL2")); 40 41?> 42--EXPECT-- 43--- After parsing, i.e. without namespace --- 44string(3) "foo" 45string(3) "foo" 46NULL 47NULL 48string(3) "baz" 49string(3) "baz" 50NULL 51NULL 52--- Special legacy case --- 53NULL 54--- Get after creating without namespace --- 55string(1) "A" 56NULL 57--- Get after creating with namespace --- 58string(1) "B" 59NULL 60