View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001567 | Xdebug | Code Coverage | public | 2018-07-26 22:03 | 2018-08-09 09:03 |
Reporter | wankata | Assigned To | derick | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
OS | Ubuntu | OS Version | 16.04.4 LTS | ||
Product Version | 2.6.0 | ||||
Summary | 0001567: Return statement in conditional causes xdebug to report the closing parenthesis as not covered | ||||
Description | When using return inside if's body, xdebug reports the closing parenthesis as not covered. It should be marked as dead code instead. As you may see in the reproduce script, lines 5 and 6 are marked as executed and line 8 is marked as not executed, but line 7 isn't there at all. This causes PHPUnit to report the line as not covered. This seems to be very similar to https://bugs.xdebug.org/view.php?id=1192 | ||||
Steps To Reproduce | Run this script: function xdebug($x) xdebug_start_code_coverage(XDEBUG_CC_DEAD_CODE|XDEBUG_CC_UNUSED); | ||||
Additional Information | aptitude show php-xdebugPackage: php-xdebug $ php --version | ||||
Tags | No tags attached. | ||||
Operating System | |||||
PHP Version | 7.2.0-7.2.4 | ||||
|
I did some more tests this morning and I realized that the problem is not really there, where I've described it. and realized that the last closing bracket is now marked with -2 (not executable) while it was marked with -1 before. And the conditional's closing bracket isn't there again (which is obviously normal). So actually not the closing bracket of the condition, but the one of the function is marked falsely as not executed instead of not executable. |
|
This is the correct behaviour. Your original test case does not cover the situation where $x != 1, and hence, the end of the function is never reached. Each function in PHP ends with an implicit "return NULL;":
function name: xdebug number of ops: 9 compiled vars: !0 = $x line #* E I O op fetch ext return operands 3 0 E > EXT_NOP branch: # 0; line: 3- 5; sop: 0; eop: 4; out0: 5; out1: 7 From this VLD output, you can see there is a branch instruction on line 4 (the JMPZ), which starts the branches at 5 and 7. |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-07-26 22:03 | wankata | New Issue | |
2018-07-27 05:17 | wankata | Note Added: 0004686 | |
2018-08-09 09:01 | derick | Note Added: 0004692 | |
2018-08-09 09:01 | derick | Status | new => resolved |
2018-08-09 09:01 | derick | Resolution | open => no change required |
2018-08-09 09:01 | derick | Assigned To | => derick |
2018-08-09 09:02 | derick | Note Edited: 0004692 | |
2018-08-09 09:03 | derick | Note Edited: 0004692 |