From 1e8e95760475e7483ac8b902e13107a408ee091d Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Tue, 20 Dec 2011 14:39:24 +0100 Subject: [PATCH 1/2] cleaning filename returned wrongly due to an XDebug bug --- PHP/CodeCoverage.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PHP/CodeCoverage.php b/PHP/CodeCoverage.php index a113d248b..dee94f51a 100644 --- a/PHP/CodeCoverage.php +++ b/PHP/CodeCoverage.php @@ -456,6 +456,11 @@ protected function applyListsFilter(&$data) protected function initializeFilesThatAreSeenTheFirstTime($data) { foreach ($data as $file => $lines) { + // Patch for XDebug bug: + // http://bugs.xdebug.org/bug_view_page.php?bug_id=0000331 + preg_match('/.*\.php/', $file, $matches); + $file = $matches[0]; + if ($this->filter->isFile($file) && !isset($this->data[$file])) { $this->data[$file] = array(); From e79fdd5f2fafb4831bd39fc84b05a9587078c10b Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Wed, 21 Dec 2011 11:50:03 +0100 Subject: [PATCH 2/2] Fix for non .php files gathered by XDebug --- PHP/CodeCoverage.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PHP/CodeCoverage.php b/PHP/CodeCoverage.php index dee94f51a..ec9025aab 100644 --- a/PHP/CodeCoverage.php +++ b/PHP/CodeCoverage.php @@ -459,7 +459,9 @@ protected function initializeFilesThatAreSeenTheFirstTime($data) // Patch for XDebug bug: // http://bugs.xdebug.org/bug_view_page.php?bug_id=0000331 preg_match('/.*\.php/', $file, $matches); - $file = $matches[0]; + if(isset($matches[0])) { + $file = $matches[0]; + } if ($this->filter->isFile($file) && !isset($this->data[$file])) { $this->data[$file] = array();