Skip to content

php(*)-xdebug: Fix post_install script#2809

Merged
z-Fng merged 1 commit intomasterfrom
fix-php-xdebug
Apr 18, 2026
Merged

php(*)-xdebug: Fix post_install script#2809
z-Fng merged 1 commit intomasterfrom
fix-php-xdebug

Conversation

@z-Fng
Copy link
Copy Markdown
Member

@z-Fng z-Fng commented Apr 18, 2026

  • Use conventional PR title: <manifest-name[@version]|chore>: <general summary of the pull request>
  • I have read the Contributing Guide

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved Xdebug installation detection and configuration across all PHP versions (5.4–8.3). Now dynamically detects installed PHP variants and writes configuration only when needed.
  • Chores

    • Added clarifying notes to package manifests documenting Xdebug enablement behavior and manual configuration fallback instructions.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

Warning

Rate limit exceeded

@z-Fng has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 19 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 51 minutes and 19 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 63e0cf23-4654-4605-9b41-03143f935b28

📥 Commits

Reviewing files that changed from the base of the PR and between f56e96e and 9b2d907.

📒 Files selected for processing (12)
  • bucket/php54-xdebug.json
  • bucket/php55-xdebug.json
  • bucket/php56-xdebug.json
  • bucket/php70-xdebug.json
  • bucket/php71-xdebug.json
  • bucket/php72-xdebug.json
  • bucket/php73-xdebug.json
  • bucket/php74-xdebug.json
  • bucket/php80-xdebug.json
  • bucket/php81-xdebug.json
  • bucket/php82-xdebug.json
  • bucket/php83-xdebug.json

Walkthrough

The PR refactors post-install scripts across all PHP Xdebug packages (versions 5.4–8.3) to dynamically detect installed PHP variants and gracefully handle missing PHP installations. Instead of failing with path-not-found errors, scripts now check if PHP exists, create directories as needed, and provide fallback instructions for manual configuration.

Changes

Cohort / File(s) Summary
PHP Xdebug Manifest Updates
bucket/php54-xdebug.json, bucket/php55-xdebug.json, bucket/php56-xdebug.json, bucket/php70-xdebug.json, bucket/php71-xdebug.json, bucket/php72-xdebug.json, bucket/php73-xdebug.json, bucket/php74-xdebug.json, bucket/php80-xdebug.json, bucket/php81-xdebug.json, bucket/php82-xdebug.json, bucket/php83-xdebug.json
Each manifest adds a top-level notes field documenting Xdebug enablement behavior. The post_install scripts are rewritten to build a multi-line Xdebug configuration string, dynamically detect installed PHP via $app parsing and installed probes over both global/local variants, compute the target conf.d\xdebug.ini path using persistdir, create parent directories, and conditionally write the file only if absent. When PHP is not detected, scripts print manual enablement instructions instead of failing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 With post_install scripts so bright,
We hop through PHP paths both left and right.
No more Convert-Path despair and fright—
When PHP's not found, we handle it right!
Xdebug now installs with bunny-blessed might! 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'php(*)-xdebug: Fix post_install script' clearly and concisely describes the main change—fixing the post_install script for all php-xdebug manifests.
Description check ✅ Passed The PR description references the linked issue #2638 and confirms the author has read the Contributing Guide and used the conventional PR title format as required.
Linked Issues check ✅ Passed All code changes across 10 php-xdebug manifests implement the core fix: gracefully handle absent PHP installations by detecting installed PHP variants dynamically, writing xdebug.ini only when the target directory exists, and providing fallback manual-enabling instructions instead of failing.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing post_install scripts in php(*)-xdebug manifests. No unrelated modifications, refactoring, or out-of-scope alterations are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-php-xdebug

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

All changes look good.

Wait for review from human collaborators.

php54-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php55-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php56-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php70-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php71-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php72-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php73-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php74-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php80-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php81-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php82-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php83-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

Check the full log for details.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bucket/php54-xdebug.json`:
- Around line 32-45: The loop that checks installed PHP copies treats only the
case where xdebug.ini is created as handled, so when an existing xdebug.ini is
present $configUpdated stays $false and fallback instructions appear; update the
foreach block (the loop using installed, $phpGlobal, $configPath, Test-Path,
ensure, Add-Content and break) so that if Test-Path -Path $configPath returns
true you set $configUpdated = $true (and optionally log a message like
"xdebug.ini already present") and break, otherwise continue with the existing
creation path (ensure + Add-Content) and set $configUpdated = $true there as
before.

In `@bucket/php55-xdebug.json`:
- Around line 32-45: The script treats only creation of xdebug.ini as handled
because $configUpdated is only set when Add-Content runs; modify the foreach
block in which you check Test-Path for $configPath (inside the installed $php
$phpGlobal branch): when Test-Path returns true, set $configUpdated = $true (and
optionally Write-Host that the existing config is detected) before breaking out,
and keep the existing behavior of creating the file when Test-Path is false;
this ensures an existing xdebug.ini is considered handled and prevents falling
through to the manual-enable fallback.

In `@bucket/php70-xdebug.json`:
- Around line 32-45: The script treats only creating xdebug.ini as "handled" so
when PHP is installed but the xdebug.ini already exists $configUpdated remains
$false and the manual-enable warning is still shown; inside the foreach block
where you compute $configPath (the installed $php $phpGlobal branch) check
Test-Path -Path $configPath and if it exists set $configUpdated = $true (and
then break), otherwise perform the existing creation steps — this ensures an
existing xdebug.ini is considered handled and prevents the false warning.

In `@bucket/php71-xdebug.json`:
- Around line 32-45: The loop that checks installed PHP versions (the foreach
over $phpGlobal and the installed $php check) currently breaks when it finds PHP
7.1 installed but an existing xdebug.ini at $configPath, leaving $configUpdated
false and causing the fallback message to show; update the logic so that when
Test-Path -Path $configPath returns true you explicitly set $configUpdated =
$true (treating the existing xdebug.ini as a handled state) before breaking out
of the loop so the manual-enable message is not printed incorrectly.

In `@bucket/php72-xdebug.json`:
- Around line 24-30: The generated INI lines for Xdebug are using Xdebug 2
settings; update the $config array entries that currently include
"xdebug.remote_enable=on", "xdebug.remote_autostart=on", and
"xdebug.remote_connect_back=on" to the Xdebug 3 equivalents: replace with
"xdebug.mode=debug", "xdebug.start_with_request=yes", and
"xdebug.discover_client_host=true", and also add "xdebug.client_port=9003"
alongside the existing zend_extension/php_xdebug.dll and "[xdebug]" lines so the
produced INI enables Xdebug 3 debugging correctly.

In `@bucket/php73-xdebug.json`:
- Around line 24-30: The INI lines built into the $config array use Xdebug 2
keys but the package is Xdebug 3; update the entries inside $config (replace
"xdebug.remote_enable=on" with "xdebug.mode=debug", replace
"xdebug.remote_autostart=on" with "xdebug.start_with_request=yes" or "trigger",
replace "xdebug.remote_connect_back=on" with "xdebug.discover_client_host=true")
and add a new line "xdebug.client_port=9003" so the generated INI uses Xdebug 3
settings.

In `@bucket/php74-xdebug.json`:
- Around line 24-30: The Xdebug INI generation uses old Xdebug 2 keys in the
$config block (zend_extension=php_xdebug.dll and the three remote_* settings);
update that $config array to Xdebug 3 keys: replace "xdebug.remote_enable=on"
with "xdebug.mode=develop,debug", replace "xdebug.remote_autostart=on" with
"xdebug.start_with_request=yes" (or "trigger" if preferred), replace
"xdebug.remote_connect_back=on" with "xdebug.discover_client_host=true", and add
"xdebug.client_port=9003"; keep the zend_extension line as-is and ensure all new
keys are included in the same $config string join used to write the INI.

In `@bucket/php81-xdebug.json`:
- Around line 28-41: The script currently leaves $configUpdated as $false when
PHP is installed but xdebug.ini already exists, causing false "manual-enable"
instructions; inside the foreach that checks installed $php $phpGlobal (the
block using $configPath, Test-Path, ensure, Add-Content and break), set
$configUpdated = $true as soon as you detect the PHP installation (either before
the Test-Path check or in an else branch when Test-Path returns true) so
existing xdebug.ini is treated as handled, and apply the same change to the
identical block in the other php*-xdebug.json manifests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6d9b07b4-c2a7-462f-8e28-f62e2199525e

📥 Commits

Reviewing files that changed from the base of the PR and between cad3647 and f56e96e.

📒 Files selected for processing (12)
  • bucket/php54-xdebug.json
  • bucket/php55-xdebug.json
  • bucket/php56-xdebug.json
  • bucket/php70-xdebug.json
  • bucket/php71-xdebug.json
  • bucket/php72-xdebug.json
  • bucket/php73-xdebug.json
  • bucket/php74-xdebug.json
  • bucket/php80-xdebug.json
  • bucket/php81-xdebug.json
  • bucket/php82-xdebug.json
  • bucket/php83-xdebug.json

Comment thread bucket/php54-xdebug.json
Comment thread bucket/php55-xdebug.json
Comment thread bucket/php70-xdebug.json
Comment thread bucket/php71-xdebug.json
Comment thread bucket/php72-xdebug.json
Comment thread bucket/php73-xdebug.json
Comment thread bucket/php74-xdebug.json
Comment thread bucket/php81-xdebug.json
@z-Fng
Copy link
Copy Markdown
Member Author

z-Fng commented Apr 18, 2026

/verify

@github-actions
Copy link
Copy Markdown
Contributor

All changes look good.

Wait for review from human collaborators.

php54-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php55-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php56-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php70-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php71-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php72-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php73-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php74-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php80-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php81-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php82-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

php83-xdebug

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate
  • Autoupdate Hash Extraction

Check the full log for details.

@z-Fng z-Fng merged commit 23c96cf into master Apr 18, 2026
5 checks passed
@z-Fng z-Fng deleted the fix-php-xdebug branch April 18, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: php-xdebug: post-install script fails when PHP is not installed

1 participant