View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001448 | Xdebug | Code Coverage | public | 2017-06-08 15:59 | 2017-07-22 08:28 |
| Reporter | nickel715 | Assigned To | derick | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | resolved | Resolution | no change required | ||
| Platform | Linux | OS | Debian | OS Version | 8 |
| Product Version | 2.5.1 | ||||
| Summary | 0001448: Line covered even though not all | ||||
| Description | I'm not sure if xdebug code coverage is intended to detect this, but I like to write php code like this: unfortunately this line is covered event though doSomething gets not executed. | ||||
| Steps To Reproduce | I provide some example code to reproduce it | ||||
| Tags | No tags attached. | ||||
| Attached Files | test.php (664 bytes)
<?php
function doSomething($param) {
echo $param; #4
} #5
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
!empty($var) && doSomething($var); #8
$data = xdebug_get_code_coverage(); #9
xdebug_stop_code_coverage();
print_r($data);
/*
[test.php] => Array
(
[8] => 1
[9] => 1
)
*/
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$var = 'hello'; #23
!empty($var) && doSomething($var); #24
$data = xdebug_get_code_coverage(); #25
xdebug_stop_code_coverage();
print_r($data);
/*
[test.php] => Array
(
[4] => 1
[5] => 1
[23] => 1
[24] => 1
[25] => 1
)
*/
| ||||
| Operating System | Linux | ||||
| PHP Version | 7.1.5-7.1.9 | ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2017-06-08 15:59 | nickel715 | New Issue | |
| 2017-06-08 15:59 | nickel715 | File Added: test.php | |
| 2017-07-22 08:28 | derick | Note Added: 0004380 | |
| 2017-07-22 08:28 | derick | Status | new => resolved |
| 2017-07-22 08:28 | derick | Resolution | open => no change required |
| 2017-07-22 08:28 | derick | Assigned To | => derick |