View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001898 | Xdebug | Uncategorized | public | 2020-11-27 07:18 | 2020-12-04 12:50 |
Reporter | sebastian | Assigned To | |||
Priority | high | Severity | feature | Reproducibility | N/A |
Status | confirmed | Resolution | open | ||
Product Version | 3.0.0RC1 | ||||
Target Version | 3.1dev | ||||
Summary | 0001898: API for querying the currently active mode(s) | ||||
Description | I 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 | ||||
Tags | No tags attached. | ||||
Operating System | |||||
PHP Version | 7.4.0-7.4.4 | ||||
|
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. |