bug72588.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Bug #72588 (Using global var doesn't work while accessing SimpleXML element)
  3. --EXTENSIONS--
  4. simplexml
  5. --FILE--
  6. <?php
  7. $tpnb = 5;
  8. $dummy = &$tpnb;
  9. $xmlStruct = <<<EOF
  10. <?xml version="1.0" encoding="UTF-8"?>
  11. <templates>
  12. <object type="obj_1" label="Label for object 1"></object>
  13. <object type="obj_2" label="Label for object 2"></object>
  14. <object type="obj_3" label="Label for object 3"></object>
  15. <object type="obj_4" label="Label for object 4"></object>
  16. <object type="obj_5" label="Label for object 5"></object>
  17. <object type="obj_6" label="Label for object 6"></object>
  18. <object type="obj_7" label="Label for object 7"></object>
  19. <object type="obj_8" label="Label for object 8"></object>
  20. <object type="obj_9" label="Label for object 9"></object>
  21. <object type="obj_10" label="Label for object 10"></object>
  22. </templates>
  23. EOF;
  24. $tplxml = simplexml_load_string($xmlStruct);
  25. var_dump($tplxml->object[$tpnb]);
  26. ?>
  27. --EXPECTF--
  28. object(SimpleXMLElement)#%d (1) {
  29. ["@attributes"]=>
  30. array(2) {
  31. ["type"]=>
  32. string(5) "obj_6"
  33. ["label"]=>
  34. string(18) "Label for object 6"
  35. }
  36. }