feature55218.phpt 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. --TEST--
  2. Bug #55218 getDocNamespaces from current element and not root
  3. --EXTENSIONS--
  4. simplexml
  5. --FILE--
  6. <?php
  7. $x = new SimpleXMLElement(
  8. '<?xml version="1.0" standalone="yes"?>
  9. <people xmlns:p="http://example.org/p" >
  10. <person id="1" xmlns:t="http://example.org/t" >
  11. <t:name>John Doe</t:name>
  12. </person>
  13. <person id="2">Susie Q. Public</person>
  14. <o>
  15. <p:div>jdslkfjsldk jskdfjsmlkjfkldjkjflskj kljfslkjf sldk</p:div>
  16. </o>
  17. </people>');
  18. echo "getDocNamespaces\n";
  19. echo "\nBackwards Compatibility:\n";
  20. echo "recursion:\n";
  21. var_dump ( $x->getDocNamespaces(true) ) ;
  22. var_dump( $x->person[0]->getDocNamespaces(true) );
  23. var_dump( $x->person[1]->getDocNamespaces(true) );
  24. echo "\nnon recursive:\n";
  25. var_dump( $x->getDocNamespaces(false) );
  26. var_dump( $x->person[0]->getDocNamespaces(false) );
  27. var_dump( $x->person[1]->getDocNamespaces(false) );
  28. echo "\n\nUsing new 'from_root' bool set to false:\n";
  29. echo "recursion:\n";
  30. var_dump ( $x->getDocNamespaces(true, false) ) ;
  31. var_dump( $x->person[0]->getDocNamespaces(true, false) );
  32. var_dump( $x->person[1]->getDocNamespaces(true, false) );
  33. echo "\nnon recursive:\n";
  34. var_dump( $x->getDocNamespaces(false, false) );
  35. var_dump( $x->person[0]->getDocNamespaces(false, false) );
  36. var_dump( $x->person[1]->getDocNamespaces(false, false) );
  37. ?>
  38. --EXPECT--
  39. getDocNamespaces
  40. Backwards Compatibility:
  41. recursion:
  42. array(2) {
  43. ["p"]=>
  44. string(20) "http://example.org/p"
  45. ["t"]=>
  46. string(20) "http://example.org/t"
  47. }
  48. array(2) {
  49. ["p"]=>
  50. string(20) "http://example.org/p"
  51. ["t"]=>
  52. string(20) "http://example.org/t"
  53. }
  54. array(2) {
  55. ["p"]=>
  56. string(20) "http://example.org/p"
  57. ["t"]=>
  58. string(20) "http://example.org/t"
  59. }
  60. non recursive:
  61. array(1) {
  62. ["p"]=>
  63. string(20) "http://example.org/p"
  64. }
  65. array(1) {
  66. ["p"]=>
  67. string(20) "http://example.org/p"
  68. }
  69. array(1) {
  70. ["p"]=>
  71. string(20) "http://example.org/p"
  72. }
  73. Using new 'from_root' bool set to false:
  74. recursion:
  75. array(2) {
  76. ["p"]=>
  77. string(20) "http://example.org/p"
  78. ["t"]=>
  79. string(20) "http://example.org/t"
  80. }
  81. array(1) {
  82. ["t"]=>
  83. string(20) "http://example.org/t"
  84. }
  85. array(0) {
  86. }
  87. non recursive:
  88. array(1) {
  89. ["p"]=>
  90. string(20) "http://example.org/p"
  91. }
  92. array(1) {
  93. ["t"]=>
  94. string(20) "http://example.org/t"
  95. }
  96. array(0) {
  97. }