[xdebug-dev] Bug 0000343: Possibly incorrect coverage information by xdebug 2.0.2

From: <noreply[@]lists.xdebug.org>
Date: Fri, 21 Dec 2007 09:35:15 +0100

The following NEW bug has been ADDED.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000343
======================================================================
Reporter: zaa
Handler:
======================================================================
Project: Xdebug
Bug ID: 343
Category: Usage problems
Reproducibility: always
Severity: trivial
Priority: normal
Status: new
Operating System: FreeBSD
PHP Version: 5.2.5
Xdebug Version: 2.0.2
======================================================================
Date Submitted: 2007-12-21 09:35 CET
Last Modified: 2007-12-21 09:35 CET
======================================================================
Summary: 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 http://bugs.xdebug.org/bug_view_page.php?bug_id=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.
======================================================================

Bug History
Date Modified Username Field Change
======================================================================
2007-12-21 09:35zaa New Bug
2007-12-21 09:35zaa Bug Monitored: zaa
======================================================================
Received on Fri Dec 21 2007 - 10:03:55 GMT

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST