diff options
author | Seth Mos <seth.mos@dds.nl> | 2010-12-20 21:06:33 +0100 |
---|---|---|
committer | Seth Mos <seth.mos@dds.nl> | 2010-12-20 21:06:33 +0100 |
commit | 81afb50916235853a9b3046796199a443d27c224 (patch) | |
tree | f25e1acd56748f178699a1edc33c123bd2182f20 /etc/inc/xmlparse.inc | |
parent | 172007f50c215acf458340773a32052c28556aaa (diff) | |
parent | 49659e1cc6f78af1287590fca7b64791fd6da6f1 (diff) | |
download | pfsense-81afb50916235853a9b3046796199a443d27c224.zip pfsense-81afb50916235853a9b3046796199a443d27c224.tar.gz |
Merge remote branch 'upstream/master'
Conflicts:
etc/inc/interfaces.inc
etc/inc/vslb.inc
usr/local/www/interfaces.php
Diffstat (limited to 'etc/inc/xmlparse.inc')
-rw-r--r-- | etc/inc/xmlparse.inc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc index 582f9b4..75871a9 100644 --- a/etc/inc/xmlparse.inc +++ b/etc/inc/xmlparse.inc @@ -179,20 +179,27 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") { while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - log_error(sprintf("XML error: %s at line %d\n", + log_error(sprintf("XML error: %s at line %d in %s\n", xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser))); + xml_get_current_line_number($xml_parser), + $cffile)); return -1; } } xml_parser_free($xml_parser); - if (!$parsedcfg[$rootobj]) { - log_error("XML error: no $rootobj object found!\n"); + if (!is_array($rootobj)) + $rootobj = array($rootobj); + foreach ($rootobj as $rootobj_name) + if ($parsedcfg[$rootobj_name]) + break; + + if (!$parsedcfg[$rootobj_name]) { + log_error("XML error: no $rootobj_name object found!\n"); return -1; } - return $parsedcfg[$rootobj]; + return $parsedcfg[$rootobj_name]; } function dump_xml_config_sub($arr, $indent) { |