feat: first-class hybrid zend_extension/zend_module_entry #21043
+93
−12
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.
This PR adds first-class support for hybrid extensions: a single extension which is both a
zend_extensionand azend_module_entry. Hybrid extensions can be loaded from INI via eitherzend_extension=andextension=and in either case, both thezend_extensionandzend_module_entrywill be loaded (there are caveats here, please read the instructions below).API/ABI Overview:
ZEND_MODULE_ENTRYmacro inZend/zend_API.h(expands to&name##_module_entry).php_try_load_hybrid_zend_extensionandzend_try_register_hybrid_module(but make sure their names are good).Backwards Compatibility Breaks:
zend_extension::reserved5is nowzend_module_entry *module_entry. This is a BC break for any extension usingreserved5.What should hybrid extension authors do?
zend_extension zend_extension_entryzend_extension_version_info extension_version_infoget_modulei.e. don't use the macroZEND_GET_MODULE(extname).zend_extension_entry'smodule_entrymember to the address of the staticzend_module_entry, i.e. use the new macroZEND_MODULE_ENTRY(extname).Why shouldn't authors publish
get_modulefor hybrid extensions?If authors publish
get_module, then thezend_extensionwill not be automatically loaded when called withextension=. This allows a migration path for "old" hybrid extensions: if they setget_module, they get the old behavior (no code changes, unless they usereserved5).Why change the status quo?