From 476ad1ab792b9cfa5f93f8d037f3ae8411a2aa2c Mon Sep 17 00:00:00 2001 From: Keanu C Date: Fri, 9 Dec 2022 17:41:52 +0000 Subject: [PATCH 1/3] Fixes erroneous not-null check --- src/phpDebug.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDebug.ts b/src/phpDebug.ts index cfb9a16a..c20d9567 100644 --- a/src/phpDebug.ts +++ b/src/phpDebug.ts @@ -414,7 +414,7 @@ class PhpDebugSession extends vscode.DebugSession { }) try { // Some checks - if (args.env !== undefined && args.program === undefined && args.runtimeArgs === undefined) { + if ((args.env && Object.keys(args.env).length !== 0) && args.program === undefined && args.runtimeArgs === undefined) { throw new Error( `Cannot set env without running a program.\nPlease remove env from [${ args.name || 'unknown' From 87eddadcf0d98f62e962b549bb1c17e816916f8b Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Fri, 9 Dec 2022 22:44:54 +0100 Subject: [PATCH 2/3] Code format and updated test. --- src/phpDebug.ts | 7 ++++++- src/test/adapter.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/phpDebug.ts b/src/phpDebug.ts index c20d9567..04944d49 100644 --- a/src/phpDebug.ts +++ b/src/phpDebug.ts @@ -414,7 +414,12 @@ class PhpDebugSession extends vscode.DebugSession { }) try { // Some checks - if ((args.env && Object.keys(args.env).length !== 0) && args.program === undefined && args.runtimeArgs === undefined) { + if ( + args.env && + Object.keys(args.env).length !== 0 && + args.program === undefined && + args.runtimeArgs === undefined + ) { throw new Error( `Cannot set env without running a program.\nPlease remove env from [${ args.name || 'unknown' diff --git a/src/test/adapter.ts b/src/test/adapter.ts index 2eb33f19..959e089a 100644 --- a/src/test/adapter.ts +++ b/src/test/adapter.ts @@ -41,7 +41,7 @@ describe('PHP Debug Adapter', () => { )) it('should error on env without program', () => - assert.isRejected(Promise.all([client.launch({ env: {} }), client.configurationSequence()]))) + assert.isRejected(Promise.all([client.launch({ env: { some: 'key' } }), client.configurationSequence()]))) it('should run program to the end', () => Promise.all([ From 367087de430a995f08add62cc6d20275ddee2c50 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Fri, 9 Dec 2022 22:45:12 +0100 Subject: [PATCH 3/3] Changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f492f3a8..a1617fb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.29.1] + +- Fix for env configuration check that sometimes causes an error. + ## [1.29.0] - Xdebug Cloud support.