View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001921 | Xdebug | Step Debugging | public | 2020-12-24 20:50 | 2021-01-04 00:46 |
Reporter | ngocphamm | Assigned To | derick | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 3.0.1 | ||||
Target Version | 3.0dev | Fixed in Version | 3.0.2 | ||
Summary | 0001921: Xdebug does not start step debugging if start_with_request=trigger | ||||
Description | I have looked through the documentation and want to only trigger Xdebug step debugging with environment variable, so I tried this [PHP.INI] xdebug.mode=debug xdebug.start_with_request=trigger xdebug.trigger_value=killdabugs xdebug.log=/usr/local/var/log/xdebug.log And I have a ZSH function so I can call "phpdebug script.php" to trigger debugging function phpdebug() { export XDEBUG_SESSION=killdabugs export XDEBUG_TRIGGER=killdabugs php $1 unset XDEBUG_SESSION unset XDEBUG_TRIGGER } This doesn't seem to work. If I set "start_with_request=yes" then it will, but it always do step debugging, and that's not what I want. | ||||
Steps To Reproduce | 1. Install php using homebrew "brew install php" 2. Install xdebug using homebrew tap shivammathur/extensions "brew install xdebug@8.0" 3. Configure xdebug as above 4. Try step debugging with a PHP script with ZSH function "phpdebug script.php" 5. Doesn't work if "start_with_request=yes" | ||||
Tags | No tags attached. | ||||
Operating System | macOS Catalina 10.15.7 | ||||
PHP Version | 8.0.0-8.0.4 | ||||
|
I'm not sure if installing xdebug from that homebrew tap would make any differences, but I also failed to install xdebug with pecl. I used to be able to before version 3.0.0. |
|
SAme here, I tried the same set up and struggled on the same behavior : that's because the presence of XDEBUG_TRIGGER is checked in the $_ENV superglobal (through find_in_globals()), and that only includes env vars set from the command line if the 'variables_order' ini param contains 'E', which apparently is not the case by default All other settings mentioned in the docs as being read fron the env (XDEBUG_MODE, XDEBUG_CONFIG...) are checked using getenv(), which works whatever the value of the 'variables_order' param. So passing XDEBUG_MODE, XDEBUG_CONFIG through the CLI env always works, but not XDEBUG_TRIGGER, which is confusing and not very clear from the docs. It also makes the start_with_request=trigger setting pretty much useless for CLI, since you cannot easily set the trigger manually in a command. |
|
FWIW, as a workaround for CLI I ended up doing : --- xdebug.ini xdebug.mode=develop xdebug.start_with_request=yes --- shell helper function xdebug() { XDEBUG_MODE="develop,debug" "$@" } But I'd find it much cleaner to go with --- xdebug.ini xdebug.mode=develop,debug xdebug.start_with_request=trigger --- shell helper function xdebug() { XDEBUG_TRIGGER=1 "$@" } as mentioned in the OP - if that worked ;-) |
|
I found that the workaround yched provided works for the same purpose (thanks!), but I agreed that the trigger should have worked as documented. |
|
https://github.com/xdebug/xdebug/pull/718 |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-12-24 20:50 | ngocphamm | New Issue | |
2020-12-24 20:51 | ngocphamm | Note Added: 0005615 | |
2020-12-25 12:39 | yched | Note Added: 0005616 | |
2020-12-25 12:45 | yched | Note Added: 0005617 | |
2020-12-25 13:47 | ngocphamm | Note Added: 0005618 | |
2020-12-31 11:49 | derick | Target Version | => 3.0dev |
2021-01-04 00:45 | derick | Assigned To | => derick |
2021-01-04 00:45 | derick | Status | new => closed |
2021-01-04 00:45 | derick | Resolution | open => fixed |
2021-01-04 00:45 | derick | Fixed in Version | => 3.0.2 |
2021-01-04 00:45 | derick | Note Added: 0005632 | |
2021-01-04 00:46 | derick | Relationship added | has duplicate 0001923 |