View Issue Details

IDProjectCategoryView StatusLast Update
0000343XdebugUncategorizedpublic2009-11-22 19:56
Reporterzaa Assigned To 
PrioritynormalSeveritytrivialReproducibilityalways
Status closedResolutionfixed 
Summary0000343: Possibly incorrect coverage information by xdebug 2.0.2
Description

xdebug 2.0.0 and 2.0.2 versions provide different coverage information for the same file.
For example, I've tried to gather coverage information for the following file:
1 <?php
2 xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
3
4 function test() {
5
6 $check_data = array(1, NULL, 3);
7 $good_records = 0;
8 foreach ($check_data as $v) {
9 if (is_null($v)) {
10 continue;
11 }
12 $good_records++;
13 }
14 }
15
16 test();
17 var_export(xdebug_get_code_coverage());
18 ?>

xdebug 2.0.0 provides the following (and it seems correct) coverage information:

array (
'/u/zaa/public_html/eshop_main/2.php' =>
array (
4 => 1,
6 => 1,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => -2,
12 => 1,
13 => 1,
14 => 1,
16 => 1,
17 => 1,
),
)

while xdebug 2.0.2 provides the following information:

array (
'/u/zaa/public_html/eshop_main/2.php' =>
array (
4 => 1,
6 => 1,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => -1,
12 => 1,
13 => 1,
14 => 1,
16 => 1,
17 => 1,
),
)

As you can see line 0000011 has different values
xdebug 2.0.0: -2
I guess it means that the line is marked as dead code.

xdebug 2.0.2: -1
I guess it means that the line is a runnable one but it was not executed.

This leads to generation of incorrect tests coverage reports in PHPUnit 3.1.9 when we are using xdebug 2.0.2.

Could you please take a look into the issue?

Thank you.

Additional Information

ps. side note, the description window above is rather small, maybe it is a good idea to make it a bit larger.

TagsNo tags attached.
Operating SystemFreeBSD
PHP Version5.2.5

Activities

derick

2009-11-22 19:56

administrator   ~0001166

Xdebug 2.0.5 and CVS HEAD (2.1-dev) already provide the same output as 2.0.0 again.

Issue History

Date Modified Username Field Change
2007-12-21 09:35 zaa New Issue
2009-11-22 19:56 derick Note Added: 0001166
2009-11-22 19:56 derick Status new => closed
2009-11-22 19:56 derick Resolution open => fixed
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized