We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 12cdce7 + c4aedbe commit acc7369Copy full SHA for acc7369
1 file changed
src/Nmap/XmlOutputParser.php
@@ -168,7 +168,15 @@ public function parse(): array
168
{
169
$xml = simplexml_load_file($this->xmlFile);
170
171
- if (!$xml instanceof SimpleXMLElement || !isset($xml->host)) {
+ if (!$xml instanceof SimpleXMLElement || !isset($xml->runstats->hosts)) {
172
+ throw new \InvalidArgumentException("{$this->xmlFile} does not appear to be valid.");
173
+ }
174
+
175
+ if ((string) $xml->runstats->hosts->attributes()->up === '0') {
176
+ return [];
177
178
179
+ if (!isset($xml->host)) {
180
throw new \InvalidArgumentException("{$this->xmlFile} does not appear to be valid.");
181
}
182
0 commit comments