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

Cannot set env without running a program (or #788

Closed
georgewells-focus opened this issue Apr 13, 2022 · 4 comments
Closed

Cannot set env without running a program (or #788

georgewells-focus opened this issue Apr 13, 2022 · 4 comments

Comments

@georgewells-focus
Copy link

PHP version: 7.4.28
Xdebug version: 3.1.4
VS Code extension version: 1.26.0

Your launch.json:

{ "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9003, "hostname": "0.0.0.0", "pathMappings": { "/var/www/syn": "${workspaceRoot}" }, "xdebugSettings": { "max_children": 1000, "max_data": 0 }, "env": { "XDEBUG_CONFIG": "log_level=7", } },

Xdebug php.ini config:

[xdebug] xdebug.mode = develop,debug xdebug.client_host = host.docker.internal xdebug.start_with_request = yes xdebug.connect_timeout_ms = 20 xdebug.log_level = 0

When starting the debugger, the following appears:

image

This seems to be caused by this change in 1.26.0:

if (args.env !== undefined && args.program === undefined && args.runtimeArgs === undefined) {
throw new Error('Cannot set env without running a program (or ')
}

Reverting back to 1.25.0 is the current workaround I'm using.

I did come across this post on Stack Overflow saying the key has been renamed from 'env' to 'environment' however I can't see this in the latest VS Code changelogs or any documentation for both this extension or for VS Code.

@zobo
Copy link
Contributor

zobo commented Apr 13, 2022

Hi!

I have introduced the error, because without running a script (by defining program) the env has no effect. And this misconception caused a lot of isses.

Looking back on the change, maybe I should have introduced a warning first...

@zobo
Copy link
Contributor

zobo commented Apr 13, 2022

Oh I also see a complete blunder in the text... It got somehow cut off... 🤦‍♂️

@georgewells-focus
Copy link
Author

Ah okay fair enough, to be fair I can just comment out my env section as I don't need it - good old copy/paste from a website somewhere. It might be worth adding something in the README against this option to specify that program must also be set?

@zobo
Copy link
Contributor

zobo commented Apr 24, 2022

I have extended the error message in #796. The env field is already in a special section in the Readme.

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

No branches or pull requests

2 participants