View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001530 | Xdebug | Code Coverage | public | 2018-03-02 14:36 | 2018-12-04 19:36 |
Reporter | andrewnicols | Assigned To | derick | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Platform | MacOS | OS | MacOS | OS Version | 10.13.3 |
Product Version | 2.6.0 | ||||
Summary | 0001530: Last line in a foreach always marked as covered | ||||
Description | The last code line in a foreach test is always marked as covered, even if not covered. | ||||
Steps To Reproduce | <?php xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); foreach (['a'] as $item) { print_r(xdebug_get_code_coverage()); | ||||
Additional Information | Reported on https://github.com/sebastianbergmann/php-code-coverage/issues/589 but I think this is actually an xdebug issue. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Operating System | MacOS | ||||
PHP Version | 7.2.0-7.2.4 | ||||
|
It seems that it's only foreach loops which are affected. Neither for, nor while loops seem to have this issue. |
|
Hi, I've had a look at this, and it's not an Xdebug issue. In the PHP Code Coverage ticket you wrote it both affects PHPDBG and Xdebug, which already hinted at it being a PHP thing. Hardly ever do we use the same implementation, so it's really unlikely we'd both have the same bug. With the script: 1 <?php I found that PHP generates the following opcodes (without opcache enabled): filename: /home/derick/dev/php/derickr-xdebug/tests/bug01530.inc
|
|
The PHP issue is: https://bugs.php.net/bug.php?id=76046 |
|
This issue is fixed in PHP for PHP 7.2.14 and 7.3.0: |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-03-02 14:36 | andrewnicols | New Issue | |
2018-03-02 14:52 | andrewnicols | File Added: bug01530.inc | |
2018-03-02 14:52 | andrewnicols | File Added: bug01530.phpt | |
2018-03-02 14:52 | andrewnicols | Note Added: 0004599 | |
2018-03-03 11:55 | derick | Note Added: 0004600 | |
2018-03-03 11:55 | derick | Assigned To | => derick |
2018-03-03 11:55 | derick | Status | new => confirmed |
2018-03-03 11:58 | derick | Note Added: 0004601 | |
2018-09-20 07:37 | derick | Target Version | => 2.7.0dev |
2018-09-20 07:38 | derick | Status | confirmed => acknowledged |
2018-09-20 07:38 | derick | Resolution | open => suspended |
2018-09-20 07:38 | derick | Target Version | 2.7.0dev => |
2018-12-04 19:36 | derick | Note Added: 0004747 | |
2018-12-04 19:36 | derick | Status | acknowledged => resolved |
2018-12-04 19:36 | derick | Resolution | suspended => no change required |