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

fix: Fixes erroneous non-null args.env check #872

Merged
merged 3 commits into from
Dec 13, 2022

Conversation

Keanu73
Copy link
Contributor

@Keanu73 Keanu73 commented Dec 9, 2022

Upon further investigation of #788 and #860, I found that, by default, if "env" is not specified, VSCode does not set it to undefined, but sets it to an empty object {}.

Code_2022-12-09_17-38-52

Code_2022-12-09_17-38-47

The extension code here checks if args.env is not equal to undefined. By logic, undefined is not equal to {} (thanks JavaScript..), thus, with the default "Listen for Xdebug" configuration launched, it will still throw this error needlessly.

Code_2022-12-09_17-38-42

I've made a fix for this by, instead, checking if args.env is equal to true (which is the equivalent of !== undefined) - and, also checks if there are more than 0 keys in the object, a.k.a the object is not empty. I can confirm that the debugger now runs normally with the default "Listen for Xdebug" configuration in my project.

@Keanu73 Keanu73 changed the title Fixes erroneous non-null args.env check fix: Fixes erroneous non-null args.env check Dec 9, 2022
@codecov
Copy link

codecov bot commented Dec 9, 2022

Codecov Report

Merging #872 (367087d) into main (f2546fd) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #872      +/-   ##
==========================================
+ Coverage   69.90%   69.96%   +0.06%     
==========================================
  Files          12       12              
  Lines        1834     1838       +4     
  Branches      375      379       +4     
==========================================
+ Hits         1282     1286       +4     
  Misses        552      552              
Impacted Files Coverage Δ
src/phpDebug.ts 63.83% <100.00%> (+0.21%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@zobo zobo merged commit 0a7a837 into xdebug:main Dec 13, 2022
@github-actions
Copy link

🎉 This PR is included in version 1.29.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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