[php-src] Issue #14067: ZEND_MOD_CONFLICTS doesn't work

From: Date: Sun, 28 Apr 2024 12:54:50 +0000
Subject: [php-src] Issue #14067: ZEND_MOD_CONFLICTS doesn't work
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246831@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/14067 Author: petk ### 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 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: ```sh ./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: ```sh ./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_

« previous php.bugs (#246831) next »