Skip to content

Conversation

rhertogh
Copy link
Contributor

@rhertogh rhertogh commented Aug 8, 2021

Q A
PHPUnit version 9.5.8
php-code-coverage 9.1.4
PHP version 8.0.5
Xdebug version 3.0.4
Installation Method Composer

Summary

If the XDEBUG_MODE environment variable is an empty string Xdebug uses its ini configuration.

Current behavior

php-code-coverage throws a Xdebug3NotEnabledException

How to reproduce

Set XDEBUG_MODE environment variable to an empty string.
Run xdebug_info()
The 'Enabled Features' section show the enabled modules according to the ini file
Run PHPunit with code coverage

Expected behavior

php-code-coverage uses ini when XDEBUG_MODE is empty.

Pull request

This PR applies the the expected behavior to php-code-coverage.

@sebastianbergmann
Copy link
Owner

Set XDEBUG_MODE environment variable to an empty string.

Why would you do that?

@rhertogh
Copy link
Contributor Author

rhertogh commented Aug 8, 2021

Set XDEBUG_MODE environment variable to an empty string.

Why would you do that?

In order to switch Xdebug modes in Docker, I have the following in my docker-compose file:

version: '3.8'
services:
  Server:
    # ...
    environment:
      # Xdebug
      - XDEBUG_MODE=${XDEBUG_MODE}
    # ... 

This works fine for Xdebug, but PHPunit produces the behavior as described above

@sebastianbergmann sebastianbergmann changed the title Fall back to ini if XDEBUG_MODE env var is empty string Empty value for XDEBUG_MODE environment variable is not handled correctly Aug 9, 2021
@sebastianbergmann
Copy link
Owner

Merged manually, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants