php / php/php-src

ZEND_MOD_CONFLICTS doesn't work

Đang mở
#14,067 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Bug Status: Needs Triage
Ngôn ngữ chính
C
Star
40.4k
Fork
8.1k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với ext/ctype/ctype.c và tái hiện vấn đề bằng các lệnh build và thứ tự tải extension qua CLI được cung cấp. Theo dõi cách ZEND_MOD_CONFLICTS được xử lý khi ctype và curl được tải theo từng thứ tự; hoàn tất khi extension xung đột bị từ chối với cảnh báo mong đợi trong cả hai trường hợp extension dùng chung.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
c, php
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.