Skip to content

Commit 577fdf3

Browse files
Xdebug sometimes reports a line with line number 0 being executed; ignore such lines.
1 parent 37964b9 commit 577fdf3

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

PHP/CodeCoverage/Driver/Xdebug.php

+18-2
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,25 @@ public function start()
8888
*/
8989
public function stop()
9090
{
91-
$codeCoverage = xdebug_get_code_coverage();
91+
$data = xdebug_get_code_coverage();
9292
xdebug_stop_code_coverage();
9393

94-
return $codeCoverage;
94+
return $this->cleanup($data);
95+
}
96+
97+
/**
98+
* @param array $data
99+
* @return array
100+
* @since Method available since Release 1.3.0
101+
*/
102+
private function cleanup(array $data)
103+
{
104+
foreach (array_keys($data) as $file) {
105+
if (isset($data[$file][0])) {
106+
unset($data[$file][0]);
107+
}
108+
}
109+
110+
return $data;
95111
}
96112
}

0 commit comments

Comments
 (0)