View Issue Details

IDProjectCategoryView StatusLast Update
0000879XdebugUncategorizedpublic2012-10-21 19:23
Reporteraharvey Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.2.1 
Summary0000879: Closing brace in trait-using class definitions is counted towards code coverage
Description

When a class is defined that uses a trait, the closing brace in the class definition is counted towards code coverage, and appears to always be -1.

This occurs both with xdebug 2.2.1 and the current git version on a current PHP-5.4 build.

Steps To Reproduce
  1. Download the attached coverage-test.zip.

  2. Run "php test.php".

  3. Note that line 10 of classes.php has a coverage count of -1, yet it's the closing brace of the WithTrait class definition. Also note that the NoTrait definition is as expected (only the opening brace is counted on line 3, and it has one invocation).

Additional Information

To put it in PHP bug tracker terms:

Current output:

array(2) {
'/tmp/coverage/classes.php' =>
array(6) {
[3] =>
int(1)
[6] =>
int(1)
[8] =>
int(1)
[9] =>
int(-1)
[10] =>
int(-1)
[11] =>
int(1)
}
'/tmp/coverage/test.php' =>
array(4) {
[5] =>
int(1)
[7] =>
int(1)
[8] =>
int(1)
[10] =>
int(1)
}
}

Expected output:

array(2) {
'/tmp/coverage/classes.php' =>
array(4) {
[3] =>
int(1)
[6] =>
int(1)
[8] =>
int(1)
[11] =>
int(1)
}
'/tmp/coverage/test.php' =>
array(4) {
[5] =>
int(1)
[7] =>
int(1)
[8] =>
int(1)
[10] =>
int(1)
}
}

TagsNo tags attached.
Attached Files
coverage-test.zip (493 bytes)
Operating SystemUbuntu Linux 12.04 (x86_64)
PHP Version5.4-dev

Activities

derick

2012-10-21 19:23

administrator   ~0002371

Fixed for Xdebug 2.2.2. Thanks for your report!

Issue History

Date Modified Username Field Change
2012-08-31 05:52 aharvey New Issue
2012-08-31 05:52 aharvey File Added: coverage-test.zip
2012-10-21 19:23 derick Note Added: 0002371
2012-10-21 19:23 derick Status new => closed
2012-10-21 19:23 derick Assigned To => derick
2012-10-21 19:23 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