View Issue Details

IDProjectCategoryView StatusLast Update
0000879XdebugUncategorizedpublic2012-10-21 19:23
Reporteraharvey Assigned To 
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.
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!