[xdebug-dev] Bug 0000238: Incorrect code coverage

From: <noreply[@]lists.xdebug.org>
Date: Fri, 9 Feb 2007 21:19:36 +0100

The following bug has been RESOLVED.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000238
======================================================================
Reporter: Arjen
Handler: derick
======================================================================
Project: Xdebug
Bug ID: 238
Category: Usage problems
Reproducibility: always
Severity: major
Priority: normal
Status: resolved
Operating System:
PHP Version: 5.2.0
Xdebug Version: 2.0.0rc2
Resolution: not fixable
======================================================================
Date Submitted: 2007-02-07 15:01 CET
Last Modified: 2007-02-09 21:19 CET
======================================================================
Summary: Incorrect code coverage
Description:
<?php

xdebug_start_code_coverage();

try {
        if(time() < 0)
                throw new Exception('lalala');
}
catch(Exception $e)
{
        echo "exception catched";
}

try {
        if(time() < 0)
        {
                throw new Exception('lalala');
        }
}
catch(Exception $e)
{
        echo "exception catched";
}

var_dump(xdebug_get_code_coverage());

array
  '/data/home/arjen/public_html/codecoverage.php' =>
    array
      6 => int 1
      7 => int 1
      9 => int 1
      15 => int 1
      16 => int 1
      20 => int 1
      25 => int 1

When short-style if-statements are used, the line 'throw new Exception(..)
is marked as executed. When curly brackets are used, the line is NOT marked
as executed. This is the expected behavior, as the exception is not thrown.
======================================================================

----------------------------------------------------------------------
 derick - 2007-02-09 21:19 CET
----------------------------------------------------------------------
Unfortunately I can not fix this, as the Zend engine simply doesn't provide
the correct line information for every opcode it uses.

Bug History
Date Modified Username Field Change
======================================================================
2007-02-07 15:01Arjen New Bug
2007-02-07 15:01Arjen Bug Monitored: Arjen
2007-02-09 21:19derick Bugnote Added: 0000563
2007-02-09 21:19derick Assigned To => derick
2007-02-09 21:19derick Resolution open => not fixable
2007-02-09 21:19derick Status new => resolved
======================================================================
Received on Fri Feb 09 2007 - 21:20:29 GMT

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