php / php/php-src

ZEND_MOD_CONFLICTS doesn't work

オープン
#14,067 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ext/ctype/ctype.c から始め、提供されたビルドコマンドと CLI 拡張機能の読み込み順序を使って問題を再現します。ctype と curl をそれぞれの順序で読み込んだときに、ZEND_MOD_CONFLICTS がどのように処理されるかを追跡します。両方の共有拡張機能のケースで、競合する拡張機能が期待される警告とともに拒否されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。