View Issue Details

IDProjectCategoryView StatusLast Update
0001898XdebugUncategorizedpublic2020-12-04 12:50
Reportersebastian Assigned To 
PriorityhighSeverityfeatureReproducibilityN/A
Status confirmedResolutionopen 
Product Version3.0.0RC1 
Target Version3.1dev 
Summary0001898: API for querying the currently active mode(s)
DescriptionI would really like for Xdebug to provide a function that returns information about which mode(s) is/are currently active. The motivation for this can be found here https://github.com/sebastianbergmann/php-code-coverage/issues/834#issuecomment-734655455
TagsNo tags attached.
Operating System
PHP Version7.4.0-7.4.4

Activities

derick

2020-11-27 12:00

administrator   ~0005549

Sebastian's reasoning:

> Besides setting the mode with xdebug.mode, you can also set the mode with the XDEBUG_MODE environment variable. If this environment variable is active, it overrides the mode as set through xdebug.mode.

I understand that Xdebug looks at the XDEBUG_MODE environment variable and changes its mode based on that. As far as I can see, though, Xdebug does not provide an API for querying its mode apart from using ini_get('xdebug.mode') (or using xdebug_info(), capturing its output through output buffering, and then parsing the generated HTML).

For a short term solution, this library can fall back to looking for/at the XDEBUG_MODE environment variable. If it is set, its string contents will be treated like the string contents of ini_get('xdebug.mode') is right now:

if (!ini_get('xdebug.mode') || !in_array('coverage', explode(',', ini_get('xdebug.mode')), true)) {
    throw new Xdebug3NotEnabledException;
}


The message of Xdebug3NotEnabledException, of course, needs to be adapted.

In the long run, though, I would really like for Xdebug to provide a function that returns information about which mode(s) is/are currently active.

Issue History

Date Modified Username Field Change
2020-11-27 07:18 sebastian New Issue
2020-11-27 12:00 derick Status new => confirmed
2020-11-27 12:00 derick Target Version => 3.0dev
2020-11-27 12:00 derick Note Added: 0005549
2020-12-04 12:50 derick Target Version 3.0dev => 3.1dev