bug38474.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Bug #38474 (getAttribute select attribute by order, even when prefixed) (OK to fail with libxml2 < 2.6.2x)
  3. --SKIPIF--
  4. <?php
  5. require_once('skipif.inc');
  6. if (version_compare(LIBXML_DOTTED_VERSION, "2.6.20", "<")) {
  7. print "skip libxml version " . LIBXML_DOTTED_VERSION;
  8. }
  9. ?>
  10. --FILE--
  11. <?php
  12. $xml = '<node xmlns:pre="http://foo.com/tr/pre"
  13. xmlns:post="http://foo.com/tr/post"
  14. pre:type="bar" type="foo" ><sub /></node>';
  15. $dom = new DomDocument();
  16. $dom->loadXML($xml);
  17. echo $dom->firstChild->getAttribute('type')."\n";
  18. echo $dom->firstChild->getAttribute('pre:type')."\n";
  19. $dom->firstChild->setAttribute('pre:type', 'bar2');
  20. $dom->firstChild->setAttribute('type', 'foo2');
  21. $dom->firstChild->setAttribute('post:type', 'baz');
  22. $dom->firstChild->setAttribute('new:type', 'baz2');
  23. echo $dom->firstChild->getAttribute('type')."\n";
  24. echo $dom->firstChild->getAttribute('pre:type')."\n";
  25. echo $dom->firstChild->getAttribute('post:type')."\n";
  26. $dom->firstChild->removeAttribute('pre:type');
  27. $dom->firstChild->removeAttribute('type');
  28. echo $dom->firstChild->getAttribute('type')."\n";
  29. echo $dom->firstChild->getAttribute('pre:type')."\n";
  30. echo $dom->firstChild->getAttribute('post:type')."\n";
  31. echo $dom->firstChild->getAttribute('new:type');
  32. ?>
  33. --EXPECT--
  34. foo
  35. bar
  36. foo2
  37. bar2
  38. baz
  39. baz
  40. baz2