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