Skip to content

php: Future-proof OPcache configuration logic for PHP 8.6 - #24380

Merged
MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
TimWolla:php-future-proof-8.5-rename
Oct 29, 2026
Merged

MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
TimWolla:php-future-proof-8.5-rename

Conversation

@TimWolla

Copy link
Copy Markdown
Contributor

With the release of PHP 8.6 the php formula which currently installs PHP 8.5 will likely start installing PHP 8.6, which PHP 8.5 being made available as php@8.5. This means the PHP configuration logic will attempt to enable OPcache for PHP 8.5 since the context_name == "php" check no longer matches, which will then break since opcache.so is not a thing for PHP 8.5.

Check for the existence of opcache.so instead to make this PHP version / formula name agnostic.

Found as part of #24377.


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Claude Opus 5.5 created the initial patch including the test. I was unhappy with the initial version and gave specific instructions to refine the patch. The comment in formula_actions.rb is written by myself, as is the commit message and PR description.

I verified that the tests fail when reverting the change to the logic. I also built the Docker image and verified that brew install php and brew install php@8.4 continue to work (including the creation of opcache.ini for PHP 8.4). I did not verify correct functionality for a (as of yet non-existent) php@8.5 formula.


With the release of PHP 8.6 the `php` formula which currently installs PHP 8.5
will likely start installing PHP 8.6, which PHP 8.5 being made available as
`php@8.5`. This means the PHP configuration logic will attempt to enable
OPcache for PHP 8.5 since the `context_name == "php"` check no longer matches,
which will then break since `opcache.so` is not a thing for PHP 8.5.

Check for the existence of `opcache.so` instead to make this PHP version /
formula name agnostic.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • PHP OPcache configuration is now created only when the OPcache extension is available. When it is missing, the configuration directory can still be set up without an OPcache configuration file, including for unversioned PHP formulas. This prevents PHP installations from receiving configuration that refers to an unavailable extension.

The PHP configuration step now checks for the version-specific opcache.so file before creating ext-opcache.ini. The specs cover cases where the file is present or absent, including an unversioned formula.

Changes: PHP OPcache configuration

Layer / File(s) Summary
Gate OPcache configuration on library availability
Library/Homebrew/install_steps/formula_actions.rb, Library/Homebrew/test/install_steps_spec.rb
run_configure_php skips OPcache setup when the version-specific opcache.so file is absent. The specs cover configuration with the file present and no configuration file when it is absent, including for an unversioned formula.

Priority: Normal

Merge Risk: Low · up to e0e61

A narrow PHP reinstall or post-install path can retain an invalid OPcache directive; removing it is a small fix that should be applied before merging.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title names the main change: OPcache configuration logic is changed to make it independent of the PHP formula name and version, for PHP 8.6. It matches the changeset, which replaces the context_na…
Description check Passed The description explains the problem and the fix. The PHP configuration logic would break when the php formula moves to PHP 8.6, because the context_name check no longer matches. The fix checks for op…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: OPcache configuration logic is changed to make it independent of the PHP formula name and version, for PHP 8.6. It matches the changeset, which replaces the context_name check with an opcache.so existence check.

Full details: Description check

Explanation

The description explains the problem and the fix. The PHP configuration logic would break when the php formula moves to PHP 8.6, because the context_name check no longer matches. The fix checks for opcache.so instead. The description also covers the tests and the manual verification steps, so it relates directly to the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f9811091-91d4-4683-9ff0-7acb8e96302b
Commits

Reviewing files that changed from the base of the PR and between 2833c25 and e0e61b8.

Files selected for processing: 2
  • Library/Homebrew/install_steps/formula_actions.rb
  • Library/Homebrew/test/install_steps_spec.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

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

Thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Oct 29, 2026
Merged via the queue into Homebrew:main with commit 3ef701b Oct 29, 2026
54 checks passed
@TimWolla
TimWolla deleted the php-future-proof-8.5-rename branch November 4, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址