Warning: xdebug.mode=coverage has to be set in php.ini

Hi guys,

My build fail when I run:

phpunit --coverage-clover clover.xml

php-coveralls --coverage_clover=clover.xml -v

I see this error/warning:

Warning: xdebug.mode=coverage has to be set in php.ini

I tried to add the XDEBUG_MODE=coverage in .travis.yml but it’s still failing.

For example:

env:
  global:
    - XDEBUG_MODE=coverage

...

script:
  - XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover clover.xml
  - vendor/bin/php-coveralls --coverage_clover=clover.xml -v

Job Failed Example:

Any ideas?
Thank you :slight_smile:

The message is pretty clear:

  coverage_clover XML file is not readable: /home/travis/build/maurobonfietti    
  /slim4-api-skeleton/clover.xml                                                 

and indeed, there’s no such file in the commit being built.

Hi @native-api!

The clover.xml file it’s generated on demand by the previous command:

phpunit --coverage-clover clover.xml

but for some reason, when I running PHPUnit to generate the code coverage

PHPUnit in Travis show me a warning: "xdebug.mode=coverage has to be set in php.ini".

So the file clover.xml it is not generated, and the next command php-coveralls finish with error.

I tried to add an environment variable, XDEBUG_MODE=coverage, to enable xdebug.mode in Travis CI but still not working for me right now…

XDEBUG_MODE support in php-code-coverage is new (or reintroduced) in 9.2.4.

Well, I set a specific version of PHP in travis.yml

php:
  - '7.3.24'
  - '7.4.0'

and now it’s working!
Best Regards,
Thanks!!

Those older versions come without XDebug 3, sidestepping the issue with php-code-coverage.

1 Like
Imprint