ZEND_MOD_CONFLICTS doesn't work
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
When building PHP extension that has ZEND_MOD_CONFLICTS listed in its dependencies, the macro is ineffective when building shared extensions or when conflicting module is registered after such extension.
For example. Suppose we add the following hypothetical change to ext/ctype/ctyp.c (to mark the ext/curl extension as conflicting for the ext/ctype):
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
--- a/ext/ctype/ctype.c
+++ b/ext/ctype/ctype.c
@@ -33,9 +33,15 @@ static PHP_MINFO_FUNCTION(ctype);
/* }}} */
+static const zend_module_dep ctype_deps[] = {
+ ZEND_MOD_CONFLICTS("curl")
+ ZEND_MOD_END
+};
+
/* {{{ ctype_module_entry */
zend_module_entry ctype_module_entry = {
- STANDARD_MODULE_HEADER,
+ STANDARD_MODULE_HEADER_EX, NULL,
+ ctype_deps,
"ctype",
ext_functions,
NULL,
(END)
Then building it with:
./buildconf
./configure --enable-ctype=shared --with-curl=shared
make
./sapi/cli/php -d extension_dir=modules -d extension=ctype -d extension=curl -m
Resulted in this output (here no warning is given):
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
...
[Zend Modules]
But I expected this output instead:
Warning: Cannot load module "ctype" because conflicting module "curl" is already loaded in Unknown on line 0
[PHP Modules]
Core
curl
date
dom
fileinfo
filter
...
[Zend Modules]
Unlike, when doing:
./sapi/cli/php -d extension_dir=modules -d extension=curl -d extension=ctype -m
the warning is displayed and extension is not loaded as it should be done.
PHP Version
All
Operating System
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ext/ctype/ctype.c and reproduce the issue using the provided build commands and CLI extension-loading orders. Trace how ZEND_MOD_CONFLICTS is handled when ctype and curl are loaded in each order; done means the conflicting extension is rejected with the expected warning in both shared-extension cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100