Summary:
In php 7, DOMDocument::loadXML emits an error when supplied with
an empty string as input. For example, I got this error:
ERROR 2: DOMDocument::loadXML(): Empty string supplied as input
This change simply checks for empty and returns an empty array
rather than attempting to parse an empty xml document.
Test Plan: ran `arc diff` on a repo that uses nosetestengine
Reviewers: #blessed_reviewers!
Subscribers: epriestley
Differential Revision: https://secure.phabricator.com/D16672
}
public function readCoverage($cover_file, $source_path) {
+ $coverage_xml = Filesystem::readFile($cover_file);
+ if (strlen($coverage_xml) < 1) {
+ return array();
+ }
$coverage_dom = new DOMDocument();
- $coverage_dom->loadXML(Filesystem::readFile($cover_file));
+ $coverage_dom->loadXML($coverage_xml);
$reports = array();
$classes = $coverage_dom->getElementsByTagName('class');