View Issue Details

IDProjectCategoryView StatusLast Update
0001903XdebugCode Coveragepublic2020-12-02 14:00
Reporterguice Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version3.0.0 
Target Version3.0devFixed in Version3.0.1 
Summary0001903: Constants should always be available, regardless of which mode Xdebug is in
DescriptionWhen running phpunit with code coverage, it runs these checks as documented -- https://xdebug.org/docs/all_functions#xdebug_start_code_coverage

But these variables are not defined with using XDebug 3 with phpunit 8.x, on php7.4

```
/app # vendor/bin/phpunit -v --coverage-text --coverage-clover ../build/logs/clover.xml
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

Runtime: PHP 7.4.12 with Xdebug 3.0.0
Configuration: /app/phpunit.xml

Use of undefined constant XDEBUG_CC_UNUSED - assumed 'XDEBUG_CC_UNUSED' (this will throw an Error in a future version of PHP)
/app # grep -r 'XDEBUG_CC_UNUSED' .
./vendor/phpunit/php-code-coverage/src/Driver/Xdebug.php: \xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
```

I found no mention of XDEBUG_CC_DEAD_CODE or XDEBUG_CC_UNUSED being removed in the update logs:
 - https://xdebug.org/docs/upgrade_guide
 - https://xdebug.org/updates
Steps To ReproduceBuild a new site with phpunit 8.x, attempt to run a unit test with code-coverage enabled.
Additional InformationI was able to successfully perform unit tests by defining XDEBUG_CC_DEAD_CODE and XDEBUG_CC_UNUSED myself within my bootstrap file.

I tried to search the bugtracker for 'XDEBUG_CC_DEAD_CODE' but I couldn't find a good search. And Google'ing did not show anything in the last week (site:bugs.xdebug.org "XDEBUG_CC_DEAD_CODE")
TagsNo tags attached.
Operating System
PHP Version7.4.10-7.4.19

Activities

guice

2020-11-30 21:54

reporter   ~0005556

Oh, I see now. This now only available with XDEBUG_MODE=coverage. I'll close this issue -- if I can find out how.

guice

2020-11-30 21:56

reporter   ~0005557

It would appear I cannot. Feel free to close this issue, and add something on the documentation about this change, please. Thank you.

derick

2020-11-30 22:43

administrator   ~0005558

I think it's a valid report. The constants should always be available.

derick

2020-12-02 14:00

administrator   ~0005563

https://github.com/xdebug/xdebug/pull/699

Issue History

Date Modified Username Field Change
2020-11-30 21:46 guice New Issue
2020-11-30 21:54 guice Note Added: 0005556
2020-11-30 21:56 guice Note Added: 0005557
2020-11-30 22:43 derick Note Added: 0005558
2020-11-30 22:43 derick Status new => confirmed
2020-11-30 22:43 derick Target Version => 3.0dev
2020-12-02 14:00 derick Summary XDEBUG_CC_DEAD_CODE and XDEBUG_CC_UNUSED are not defined in XDebug 3 => Constants should always be available, regardless of which mode Xdebug is in
2020-12-02 14:00 derick Note Added: 0005563
2020-12-02 14:00 derick Assigned To => derick
2020-12-02 14:00 derick Status confirmed => closed
2020-12-02 14:00 derick Resolution open => fixed
2020-12-02 14:00 derick Fixed in Version => 3.0.1