bug38474.phpt 1.3 KB

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