Repository navigation
fix: lowercase PHP_IDE_CONFIG serverName for uppercase project names, fixes #8225 (#8248) [skip ci] - #8248
Merged
Conversation
…ixes ddev#8225 ## The Issue - Fixes ddev#8225 When a DDEV project name contains uppercase letters (e.g. `ISSUE-123`), CLI-based PHP debugging fails in PhpStorm. The web server (nginx) lowercases `SERVER_NAME`, so PhpStorm registers the server as `issue-123.ddev.site`. But `PHP_IDE_CONFIG` was set using `${DDEV_SITENAME}` which preserves the original case, giving `serverName=ISSUE-123.ddev.site` — a case-sensitive mismatch that causes PhpStorm to immediately detach. ## How This PR Solves The Issue Change `PHP_IDE_CONFIG=serverName=${DDEV_SITENAME}.${DDEV_TLD}` in `app_compose_template.yaml` to use `{{ .Name | lower }}` (sprig's `lower` function, already available in the template FuncMap) so the server name is always lowercase and consistent with what nginx reports. ## Manual Testing Instructions 1. Create a project with an uppercase name: `ddev config --project-name=ISSUE-123` 2. `ddev start` 3. In PhpStorm, confirm the auto-configured server name is `issue-123.ddev.site` 4. Enable Xdebug: `ddev xdebug on` 5. Run a CLI PHP script with Xdebug: `ddev exec php -r "echo 1;"` 6. Confirm PhpStorm connects and does not immediately detach ## Automated Testing Overview Added `TestPHPIDEConfigLowercase` in `pkg/ddevapp/config_test.go`. It creates an app with `Name = "ISSUE-123"`, renders the compose template via `WriteDockerComposeYAML()`, and asserts the base YAML contains `PHP_IDE_CONFIG=serverName=issue-123.` (lowercase) and not `ISSUE-123.`. No Docker start required — exercises the Go template rendering path only. ## Release/Deployment Notes Projects with uppercase names will have their `PHP_IDE_CONFIG` serverName lowercased going forward. This is a fix-only change; lowercase names are unaffected. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Download the artifacts for this pull request:
See Testing a PR. |
Member
Author
|
I looked again and manually tested before and after, and it seems fine. Using the suggested |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Issue
When a DDEV project name contains uppercase letters (e.g.
ISSUE-123),CLI-based PHP debugging fails in PhpStorm. The web server (nginx) lowercases
SERVER_NAME, so PhpStorm registers the server asissue-123.ddev.site.But
PHP_IDE_CONFIGwas set using${DDEV_SITENAME}which preserves theoriginal case, giving
serverName=ISSUE-123.ddev.site— a case-sensitivemismatch that causes PhpStorm to immediately detach.
How This PR Solves The Issue
Change
PHP_IDE_CONFIG=serverName=${DDEV_SITENAME}.${DDEV_TLD}inapp_compose_template.yamlto use{{ .Name | lower }}(sprig'slowerfunction, already available in the template FuncMap) so the server name is
always lowercase and consistent with what nginx reports.
Manual Testing Instructions
ddev config --project-name=ISSUE-123ddev startissue-123.ddev.siteddev xdebug onddev exec php -r "echo 1;"Automated Testing Overview
Added
TestPHPIDEConfigLowercaseinpkg/ddevapp/config_test.go. It createsan app with
Name = "ISSUE-123", renders the compose template viaWriteDockerComposeYAML(), and asserts the base YAML containsPHP_IDE_CONFIG=serverName=issue-123.(lowercase) and notISSUE-123..No Docker start required — exercises the Go template rendering path only.
Release/Deployment Notes
Projects with uppercase names will have their
PHP_IDE_CONFIGserverNamelowercased going forward. This is a fix-only change; lowercase names are
unaffected.