Refactor xdebug + intl to use loadPHPExtension helper (draft, stacked) - #3547
Closed
adamziel wants to merge 2 commits into
Closed
Refactor xdebug + intl to use loadPHPExtension helper (draft, stacked)#3547adamziel wants to merge 2 commits into
adamziel wants to merge 2 commits into
Conversation
The 'with*' wrappers needed two API tweaks before they could share code with the blueprint step from #3545: 1. A sync, FS-level installer (installPHPExtensionFilesSync). The wrappers run inside Emscripten's onRuntimeInitialized, where only the raw PHPRuntime.FS is available — UniversalPHP doesn't exist yet, and php.ini hasn't been written. 2. An extraFiles option for companion data files. intl needs to drop icu.dat next to the .so; without this the wrappers had to keep their own bespoke FS-write code. Both helpers (async loadPHPExtension and sync installPHPExtensionFilesSync) share a buildExtensionFiles() core, so the on-disk layout stays in lockstep between blueprint-loaded extensions and the bundled ones. with-xdebug shrinks from ~80 lines of FS plumbing to a single call plus its iniEntries map; with-intl from ~60 to one call with an extraFiles entry. Behavior is unchanged.
The strict-equality tests in php-dynamic-loading.spec.ts expect the exact original byte sequence (lines joined with \n, no trailing \n). The previous helper in this PR added a trailing newline, which broke 14 tests across all PHP versions (XDebug + Intl ini-content checks). Drop the trailing newline; PHP's ini parser is happy with either.
This was referenced Apr 28, 2026
Collaborator
Author
|
Superseded by #3566, which consolidates the extension loader, Blueprint API, compile helper, and bundled extension migration into one trunk-based PR. |
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.
Stacked on #3545.
Why
When I tried to dogfood the
loadPHPExtension()API from #3545 against the bundled extension wrappers (with-xdebug,with-intl), two gaps surfaced:onRuntimeInitializedwhere only a rawPHPRuntime.FSis available —UniversalPHPdoesn't exist yet, andphp.inihasn't been written.with-intlneeds to dropicu.datnext to the.so. The original API had no way to express "ship these companion files alongside the extension."So this PR extends the API and converts both wrappers to use it.
API additions
installPHPExtensionFilesSync(fs, options)— sync, raw-FS sibling ofloadPHPExtension. Both helpers share abuildExtensionFiles()core so the on-disk layout stays in lockstep between blueprint-loaded and bundled extensions.extraFiles: Array<{ path, data }>option — companion data files. Used by intl foricudt74l.dat; future-friendly for things like MaxMind GeoIP.mmdbfiles.Refactors
with-xdebug.ts: ~80 lines of FS plumbing → oneinstallPHPExtensionFilesSynccall plus aniniEntriesmap. The/.xdebug/path-mapping block stays inline because it writes outside the extensions dir.with-intl.ts: ~60 lines → one call with anextraFilesentry. ENV setup (ICU_DATA,PHP_INI_SCAN_DIR) stays at the EmscriptenOptions layer because Emscripten ENV must be set before runtime init.Out of scope
Test plan