View Issue Details

IDProjectCategoryView StatusLast Update
0000238XdebugUncategorizedpublic2007-02-09 21:19
ReporterArjen Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionnot fixable 
Summary0000238: 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.

TagsNo tags attached.
Operating System
PHP Version5.2.0

Activities

derick

2007-02-09 21:19

administrator   ~0000563

Unfortunately I can not fix this, as the Zend engine simply doesn't provide the correct line information for every opcode it uses.