PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.15.0
Import WP – CSV & XML Import Export for WordPress v2.15.0
2.15.1 2.15.0 2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 All 144 releases
← All changes | class/Common/Importer/Parser/XMLParser.php +8 -4 2.8.1 → 2.15.0 View file →
@@ -34,11 +34,13 @@
34 34 $output = [];
35 35 $sub_records = $this->query($group['base'], false);
36 36 $this->setQueryBase($group['base']);
37 37
38 - foreach ($sub_records as $record) {
39 - $this->record_xml = $record;
40 - $output[] = parent::queryGroup($group);
38 + if (!empty($sub_records)) {
39 + foreach ($sub_records as $record) {
40 + $this->record_xml = $record;
41 + $output[] = parent::queryGroup($group);
42 + }
41 43 }
42 44
43 45 $this->resetQueryBase();
44 46 } else {
@@ -68,9 +70,11 @@
68 70 return false;
69 71 }
70 72
71 73 $results = $this->record_xml->xpath($xpath_prefix . $query);
72 - if (count($results) > 0) {
74 +
75 + // make sure the result has records
76 + if (is_array($results) && count($results) > 0) {
73 77 if ($as_string) {
74 78 $temp = [];
75 79 foreach ($results as $result) {
76 80 $temp[] = (string) $result;