View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001541 | Xdebug | Code Coverage | public | 2018-03-26 14:42 | 2019-08-26 12:37 |
| Reporter | theoboldt | Assigned To | |||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | duplicate | ||
| Platform | Linux | OS | Ubuntu | OS Version | 16.04.1 |
| Product Version | 2.6.0 | ||||
| Target Version | 2.8.0dev | Fixed in Version | 2.8.0beta2 | ||
| Summary | 0001541: switch/case case is not covered when using php-fpm php 7.0 | ||||
| Description | When executing switch/case within a function, no case line of executed cases is marked as covered, except the following:
The lines are marked as covered as expected when the same file is executed via CLI using same php/xdebug version. {code}
{code} When executing above code via CLI, following output is generated:
{code} When executing above code via Apache 2 (Server API: FPM/FastCGI, PHP API: 20151012, PHP Extension: 20151012) the output differs significantly for line 8 and 11:
{code} | ||||
| Steps To Reproduce | Execute provided using php 7.0.28 snipped via php-fpm and via cli as well, compare results | ||||
| Tags | PHP7, php7.2 | ||||
| Operating System | |||||
| PHP Version | 7.0.25-7.0.29 | ||||
|
|
Still reproducible using xdebug 2.6.1. |
|
|
Do you have opcache installed and enabled for the PHP-FPM install? |
|
|
Result having opcache enabled: Result having opcache disabled: |
|
|
Also reproducible using php 7.2: opcache enabled: opcache disabled: |
|
|
I will have a look at this after Xdebug 2.7.0 has been released. I haven't reproduced it yet, so will leave the issue in "acknowledged" for now. |
|
|
I can't reproduce this - is this still causing you trouble? |
|
|
Still reproducible using Xdebug 2.7.2, PHP FPM, having opcache enabled:
Still reproducible using Xdebug 2.7.2, PHP FPM, having opcache disabled:
|
|
|
I just spend another two hours setting this up in a new and pristine VM with Ubuntu 18.04.2 LTS, which from what I can see is the exact same environment. The result is: Opcache disabled:
Opcache enabled:
As you can see, I still can't reproduce this. I installed Xdebug from source and I also tried the php-xdebug package (Xdebug 2.6.0), and I still get the same result. There must be something different in your environment, although I can't see what would impact this. Is there any chance you can set-up a VM or something that shows the problem and you can give me access to? |
|
|
We identified the configuration responsible for the error. If the configuration contains xdebug.coverage_enable = 0, the error occurs. If the related configuration option is put in comments, no error occurs. If xdebug.coverage_enable = 1is configured, no error occurs. I'd say that this should still be regarded as error, since it prevents users from collecting code coverage data of only specific snippets. We created a docker image which can be used to reproduce the error. When docker container is loaded and running, the container provides a web server at port 80. Proof can be found via /index.php. The bzip2 compressed docker image can be accessed within 7 days via: https://send.firefox.com/download/9b4b0fd39342cbca/#s7XDxm7K7sSWRmHY113vlQ |
|
|
Oh! If you turn off I can reproduce it when that configuration setting, so feel free to remove your Docker container. |
|
|
Fixed in 2.8.0beta2, by making sure there is a warning when you want to use code coverage when xdebug.code_coverage=0 (and duplicate of 0001540) |