Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty value for XDEBUG_MODE environment variable is not handled correctly #860

Closed
wants to merge 1 commit into from

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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants