feat: guard get_module export for statically linked extensions - #764
Merged
ptondereau merged 5 commits intoAug 20, 2026
Merged
Conversation
…EXT_PHP_RS_STATIC_EXT
…refixed get_module
Member
Author
|
@TobiasBengtsson @okhoshi did my best, and some CI tests are ugly, but let's have some feedbacks |
Coverage Report for CI Build 32383225875Coverage increased (+0.1%) to 66.98%Details
Uncovered Changes
Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
|
| Project | ext-php-rs |
| Branch | feat/guard-get-module-763 |
| Testbed | PHP 8.4.24 (cli) (built: Jul 29 2026 09:44:18) (NTS) |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
🐰 View full continuous benchmarking report in Bencher
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
ptondereau
marked this pull request as ready for review
August 20, 2026 15:27
okhoshi
reviewed
Aug 20, 2026
okhoshi
approved these changes
Aug 20, 2026
ptondereau
enabled auto-merge (squash)
August 20, 2026 17:01
ptondereau
disabled auto-merge
August 20, 2026 17:01
Merged
2 of 4 tasks
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.
Description
Closes #763.
A statically linked ext-php-rs extension always exported
get_module, so it collided at link time with any other extension exporting the same symbol, like a C extension missing the#ifdef COMPILE_DL_extguard.#[php_module]now also exports a crate-prefixed<crate>_get_module, and building withEXT_PHP_RS_STATIC_EXT=1drops the unprefixed export while keeping the function callable from Rust. Thestatic-glueshim calls the prefixed symbol, derived from the library target name rather than--ext-name. The variable replaces the unreleasedEXT_PHP_RS_STATIC_TSRMLS_CACHEand also enables the static TSRMLS cache, so static builds need a single switch. Verified end to end on a two-pass PHP 8.5 ZTS build: linking next to an unguarded C extension failed withmultiple definition of 'get_module'before, and links and runs with both modules loaded after. CI now asserts the symbol gating withnmon the hello_world cdylib.Checklist