Skip to content

fix: lowercase PHP_IDE_CONFIG serverName for uppercase project names, fixes #8225 (#8248) [skip ci] - #8248

Merged
rfay merged 1 commit into
ddev:mainfrom
rfay:20260322_lowercase_phpstorm
Mar 23, 2026
Merged

rfay merged 1 commit into
ddev:mainfrom
rfay:20260322_lowercase_phpstorm

Conversation

@rfay

@rfay rfay commented Mar 22, 2026

Copy link
Copy Markdown
Member

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 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.

…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]>
@github-actions

Copy link
Copy Markdown

@rfay
rfay marked this pull request as ready for review March 23, 2026 14:36
@rfay
rfay requested a review from a team as a code owner March 23, 2026 14:36
@rfay

rfay commented Mar 23, 2026

Copy link
Copy Markdown
Member Author

I looked again and manually tested before and after, and it seems fine. Using the suggested chmod +x web/core/scripts/drupal && ddev start && ddev xdebug on && ddev exec web/core/scripts/drupal shows the problem and this PR solves it. I don't see any way it can do any harm either.

@rfay
rfay requested a review from stasadev March 23, 2026 14:38

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@rfay rfay changed the title fix: lowercase PHP_IDE_CONFIG serverName for uppercase project names, fixes #8225 fix: lowercase PHP_IDE_CONFIG serverName for uppercase project names, fixes #8225 (#8248) [skip ci] Mar 23, 2026
@rfay
rfay merged commit 5a450b4 into ddev:main Mar 23, 2026
36 checks passed
@rfay
rfay deleted the 20260322_lowercase_phpstorm branch March 23, 2026 22:36
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.

Uppercase project names break CLI Xdebug: PHP_IDE_CONFIG serverName doesn't match PhpStorm's default

2 participants