Conversation
✅ Deploy Preview for lando-php ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed:
XDEBUG_MODEenv var silently defeats runtime toggle- Removed XDEBUG_MODE environment variable from line 315 to allow INI-based toggle script to control xdebug mode without env var override.
- ✅ Fixed:
XDEBUG_CONFIGoverrides user-specifiedclient_hostsetting- Updated xdebugConfig() function to accept and use the user's normalized configuration values instead of hardcoded values for client_host and log settings.
Or push these changes by commenting:
@cursor push 8dd8b2ff7d
Preview (8dd8b2ff7d)
diff --git a/builders/php.js b/builders/php.js
--- a/builders/php.js
+++ b/builders/php.js
@@ -51,15 +51,15 @@
version: options.via.split(':')[1],
});
-const xdebugConfig = phpSemver => {
+const xdebugConfig = (phpSemver, normalizedConfig) => {
const config = [
- 'client_host=host.lando.internal',
+ `client_host=${normalizedConfig.client_host}`,
'discover_client_host=1',
- 'log=/tmp/xdebug.log',
+ `log=${normalizedConfig.log === false ? '' : normalizedConfig.log}`,
];
if (phpSemver && semver.lt(phpSemver, '7.2.0')) {
- config.push('remote_enable=true', 'remote_host=host.lando.internal');
+ config.push('remote_enable=true', `remote_host=${normalizedConfig.client_host}`);
}
return config.join(' ');
@@ -311,8 +311,7 @@
environment: _.merge({}, options.environment, {
PATH: options.path.join(':'),
LANDO_WEBROOT: `/app/${options.webroot}`,
- XDEBUG_CONFIG: xdebugConfig(phpSemver),
- XDEBUG_MODE: options._xdebugConfig.mode,
+ XDEBUG_CONFIG: xdebugConfig(phpSemver, options._xdebugConfig),
}),
networks: (_.startsWith(options.via, 'nginx')) ? {default: {aliases: ['fpm']}} : {default: {}},
ports: (_.startsWith(options.via, 'apache') && options.version !== 'custom') ? ['80'] : [],- Remove XDEBUG_MODE env var to allow INI-based toggle to work - Update xdebugConfig() to use user's normalized config values instead of hardcoded values - Fixes client_host and other settings being overridden by XDEBUG_CONFIG env var Applied via @cursor push command
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Hardcoded
max_nesting_levelduplicates config pass-through entries- Moved max_nesting_level default (512) to config defaults in normalizeXdebugConfig, eliminating duplicate ini entries.
Or push these changes by commenting:
@cursor push bc1017f136
Preview (bc1017f136)
diff --git a/builders/php.js b/builders/php.js
--- a/builders/php.js
+++ b/builders/php.js
@@ -78,7 +78,9 @@
client_port: 9003,
log: '/tmp/xdebug.log',
idekey: '',
- config: {},
+ config: {
+ max_nesting_level: 512,
+ },
};
if (xdebug === true) return _.merge({}, defaults, {mode: 'debug'});
@@ -104,7 +106,6 @@
const ini = [
'; Generated by Lando PHP plugin',
`xdebug.mode = ${config.mode}`,
- `xdebug.max_nesting_level = 512`,
`xdebug.start_with_request = ${config.start_with_request}`,
`xdebug.client_host = ${config.client_host}`,
`xdebug.client_port = ${config.client_port}`,There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Test expects
XDEBUG_MODEenv var that code no longer sets- Updated the test to check xdebug mode via
php -i | grep "xdebug.mode"instead of checking theXDEBUG_MODEenvironment variable that is no longer set.
- Updated the test to check xdebug mode via
Or push these changes by commenting:
@cursor push e62e7d0f9c
Preview (e62e7d0f9c)
diff --git a/examples/xdebug/README.md b/examples/xdebug/README.md
--- a/examples/xdebug/README.md
+++ b/examples/xdebug/README.md
@@ -52,7 +52,7 @@
lando exec xdebug-true -- php -i | grep "xdebug.mode" | grep debug
# Should set mode from string (backward compat)
-lando exec xdebug-string -- env | grep XDEBUG_MODE | grep "debug,develop"
+lando exec xdebug-string -- php -i | grep "xdebug.mode" | grep "debug,develop"
# Should set mode from object config
lando exec xdebug-object -- php -i | grep "xdebug.mode" | grep debugThere was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Disabled xdebug changes from falsy to truthy value
- Changed line 287 to preserve false (falsy) when xdebug mode is 'off' instead of setting it to the string 'off' (truthy), maintaining backward compatibility for truthiness checks.
Or push these changes by commenting:
@cursor push f7e206bb7a
Preview (f7e206bb7a)
diff --git a/builders/php.js b/builders/php.js
--- a/builders/php.js
+++ b/builders/php.js
@@ -284,7 +284,7 @@
}
options._xdebugConfig = normalizeXdebugConfig(options.xdebug);
- options.xdebug = options._xdebugConfig.mode;
+ options.xdebug = options._xdebugConfig.mode !== 'off' ? options._xdebugConfig.mode : false;
if (options._xdebugConfig.mode !== 'off') {
const xdebugFile = path.join(options.confDest, options.defaultFiles.xdebug);
fs.mkdirSync(options.confDest, {recursive: true});There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Custom xdebug settings lost when toggling from off
- The yyy-lando-xdebug.ini file is now always generated with all custom settings regardless of mode, ensuring configuration persists when toggling xdebug on.
Or push these changes by commenting:
@cursor push bdb96bca48
Preview (bdb96bca48)
diff --git a/builders/php.js b/builders/php.js
--- a/builders/php.js
+++ b/builders/php.js
@@ -285,12 +285,10 @@
options._xdebugConfig = normalizeXdebugConfig(options.xdebug);
options.xdebug = options._xdebugConfig.mode;
- if (options._xdebugConfig.mode !== 'off') {
- const xdebugFile = path.join(options.confDest, options.defaultFiles.xdebug);
- fs.mkdirSync(options.confDest, {recursive: true});
- fs.writeFileSync(xdebugFile, generateXdebugIni(options._xdebugConfig));
- options.volumes.push(`${xdebugFile}:${options.remoteFiles.xdebug}`);
- }
+ const xdebugFile = path.join(options.confDest, options.defaultFiles.xdebug);
+ fs.mkdirSync(options.confDest, {recursive: true});
+ fs.writeFileSync(xdebugFile, generateXdebugIni(options._xdebugConfig));
+ options.volumes.push(`${xdebugFile}:${options.remoteFiles.xdebug}`);
options._app.config.tooling = options._app.config.tooling || {};
if (_.get(options, '_app.config.tooling.xdebug') === undefined) {When xdebug mode defaults to 'off', custom settings like client_port, start_with_request, and idekey were not being persisted to the ini file. This caused settings to be lost when toggling xdebug on later. Now the yyy-lando-xdebug.ini file is always created with all settings, regardless of mode, ensuring custom configuration persists through xdebug toggles. Applied via @cursor push command
- Fix config pass-through producing duplicate ini directives by using an ordered Map instead of array appending. Pass-through values now override defaults naturally without duplicates. - Add try/catch around sync fs writes for xdebug ini file to surface meaningful error messages on failure. - Add comments explaining the yyy/zzz ini layering strategy in both builders/php.js and scripts/xdebug.sh.



Summary
Complete overhaul of xdebug support in the PHP plugin, addressing the #1 source of developer pain.
Phase 1: Fix broken stuff
remote_autostart) from default php.ini — fixes deprecation warnings on PHP 7.2+ (XDEBUG 3 complains about xdebug.remote_autostart = 1 in /usr/local/etc/php/conf.d/xxx-lando-default.ini #92, Warnings in newer versions of xdebug lando#3389)xdebugConfig()to usehost.lando.internal(Lando core's portable hostname) instead of build-time resolved IP — fixes connection drops on network change (XDebug connection drops when host IP address changes #43) and WSL2 issues (#2540)remote_enable,remote_host) only included for PHP <7.2Phase 2: Built-in
lando xdebugtogglescripts/xdebug.sh— POSIX/bin/shcompatible toggle scriptlando xdebug debug/lando xdebug off/lando xdebug debug,develop— no rebuild requiredlando xdebug(no args) shows status: loaded state, mode, client host, client portPhase 3: Configurable xdebug object
.lando.yml:true,false, and string formats still work identicallyyyy-lando-xdebug.ini(loads after defaults, before user custom)zzz-lando-xdebug.ini) always takes precedencePhase 4: Developer experience
lando infonow includes xdebug configuration (mode, client_host, client_port, start_with_request)Tests
normalizeXdebugConfig()andgenerateXdebugIni()(13 passing)Related issues
Note
Medium Risk
Moderate risk because it changes how Xdebug is configured/enabled at build/runtime (new ini generation, new defaults, new tooling), which can affect developer debugging behavior across PHP versions.
Overview
Overhauls Xdebug configuration for the PHP service by generating a dedicated
yyy-lando-xdebug.inifrom.lando.yml(including a new object-style config while keeping boolean/string backward compatibility) and wiring the result into the container via volume mount andXDEBUG_CONFIG.Adds built-in
lando xdebugtooling via a newscripts/xdebug.shthat can togglexdebug.modeat runtime (writingzzz-lando-xdebug.iniand reloading Apache/PHP-FPM) without requiringlando rebuild, and surfaces key Xdebug settings inlando infooutput.Cleans up legacy Xdebug 2 ini settings from the default
php.ini, updates examples/docs/tests accordingly, and bumpspackage-lock.jsonversion metadata.Written by Cursor Bugbot for commit 89a5d67. This will update automatically on new commits. Configure here.