}
function xml_value($tags, $more_tags="[0]['#']") {
- $tags = empty($tags) ? '' : "['".str_replace(",", "'][0]['#']['", $tags)."']";
- eval('$value = &$this->xml'.$this->xml_root.$tags.$more_tags.';');
+ $value = null;
+ if (isset($this->xml) && is_array($this->xml)) {
+
+ $all_tags = $this->xml_root;
+ if ($tags) {
+ $all_tags .= "['".str_replace(",", "'][0]['#']['", $tags)."']";
+ }
+ $all_tags .= $more_tags;
+
+ $pos = strrpos($all_tags, '[');
+ if ($pos===false) {
+ $most_tags = ''; // shouldn't happen !!
+ } else {
+ $most_tags = substr($all_tags, 0, $pos);
+ }
+
+ eval('if (isset($this->xml'.$most_tags.') && is_array($this->xml'.$most_tags.') && isset($this->xml'.$all_tags.')) {'
+ .'$value = &$this->xml'.$all_tags.';'
+ .'} else {'
+ .'$value = null;'
+ .'}'
+ );
+ }
if (is_string($value)) {