View Issue Details

IDProjectCategoryView StatusLast Update
0001787XdebugCode Coveragepublic2020-05-28 13:03
Reporterdvdoug Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.9.5 
Fixed in Version2.9.6 
Summary0001787: Branch coverage data does not always follow the lines/functions format
Description

Sometimes, for files that don't contain functions I've noticed that Xdebug doesn't always return coverage data inside the lines/functions structure

Steps To Reproduce

1.php

<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE | XDEBUG_CC_BRANCH_CHECK);
require '2.php';

print_r(xdebug_get_code_coverage()); // the data for 1.php is not in a lines/functions structure, although the data for 2.php is

2.php
<?php

$foo = 'bar';

Additional Information

Adding a function into the file, changes the output structure

<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE | XDEBUG_CC_BRANCH_CHECK);
require '2.php';

function foo()
{
$foo = 1;
}

print_r(xdebug_get_code_coverage()); // now the data for both files is returned in a lines/functions structure

TagsNo tags attached.
Operating System
PHP Version7.4.0-7.4.4

Relationships

has duplicate 0001788 resolvedderick Branch coverage data does not always get returned in the lines/functions format (w/Opcache) 

Activities

derick

2020-05-28 12:10

administrator   ~0005418

Hi!

Thanks for this report. This is now fixed in Git for xdebug 2.9.6 (and 3.0). I'll have a look at 0001788 next, but I bet it's the same problem.

cheers,
Derick

Issue History

Date Modified Username Field Change
2020-05-24 14:08 dvdoug New Issue
2020-05-28 12:10 derick Assigned To => derick
2020-05-28 12:10 derick Status new => closed
2020-05-28 12:10 derick Resolution open => fixed
2020-05-28 12:10 derick Fixed in Version => 2.9.6
2020-05-28 12:10 derick Note Added: 0005418
2020-05-28 13:03 derick Relationship added has duplicate 0001788