1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 10:12:41 +01:00

Fix an DOMDocument error with NoseTestEngine running on PHP 7

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
This commit is contained in:
Mukunda Modell 2016-10-05 15:19:15 -05:00
parent 2ad15c499a
commit 2962504855

View file

@ -126,8 +126,12 @@ final class NoseTestEngine extends ArcanistUnitTestEngine {
}
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');