Skip to content

PHP 8.6: restore mbstring in Apache and CLI images - #103

Merged
jakubboucek merged 2 commits into
masterfrom
php-fix-mbstring
Oct 13, 2026
Merged

jakubboucek merged 2 commits into
masterfrom
php-fix-mbstring

Conversation

@jakubboucek

Copy link
Copy Markdown
Owner

PHP 8.6 images are missing mbstring, so applications using functions such as mb_strlen() and mb_convert_encoding() fail. Upstream deliberately stopped compiling it into the base images when removing PEAR/PECL in docker-library/php#1654. Earlier versions inherited the extension from upstream; PHP 8.6 needs an explicit installation in our images.

This change builds the bundled mbstring extension in the PHP 8.6 Apache and CLI Dockerfiles, using libonig-dev during compilation and retaining libonig5 after development packages are purged. It adds functional coverage for Unicode length, substrings, searching, case conversion, UTF-8 validation and encoding conversion. The test follows existing extension-test conventions and skips only when the extension is absent.

Dependency verification

Ran tools/compute-minimal-ext-deps.php on an existing PHP 8.6.0RC3 image, then installed and compiled only mbstring in a disposable container and ran the helper again. The sole additional runtime package was libonig5 (libonig.so.5.4.0); the extension also uses the existing libc6. After marking libonig5 manual and purging libonig-dev, the report was unchanged and the functional test still passed. No extra compiler flags were needed.

Validation

  • Before the fix, the new test passed in all 12 PHP 8.2–8.5 base/CLI/debug profiles and skipped in the three then-tested PHP 8.6 RC profiles.
  • After rebasing onto master, rebuilt both Apache and CLI images from this exact branch under isolated local tags.
  • Both rebuilt images pass the 24-test suite with two expected skips: memcached is still absent on master (handled separately in PHP 8.6: Restore memcached and add debug images #102), and the legacy PDO test applies only through PHP 8.4. The mbstring test runs and passes.
  • Re-ran the dependency helper in both final images: mbstring resolves to libonig5 and libc6. Verified libonig5 remains installed and libonig-dev has been removed.
  • git diff --check passes. Images were not published.

This PR targets master and contains only the mbstring fix and its test. It has no dependency on #102 or the extension-inventory proposal.

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

🟢 Approval recommended

The dependency lifecycle, extension compilation, and functional coverage are consistent and complete.

0 open findings

What changed in this PR

Restores mbstring support in PHP 8.6 Apache and CLI images.

Changes:

  • Adds mbstring build/runtime dependencies.
  • Compiles the bundled extension.
  • Adds Unicode-focused functional tests.
File Description
php/​Dockerfile-8.6 Enables mbstring in the Apache image.
php/​Dockerfile-8.6-cli Enables mbstring in the CLI image.
tools/​tests/​Extensions/​MbstringTest.php Tests core mbstring operations.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jakubboucek
jakubboucek merged commit 1ea9311 into master Oct 13, 2026
1 check passed
@jakubboucek
jakubboucek deleted the php-fix-mbstring branch October 13, 2026 11:42
@jakubboucek
jakubboucek restored the php-fix-mbstring branch October 13, 2026 11:49
@jakubboucek
jakubboucek deleted the php-fix-mbstring branch October 13, 2026 11:49
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