BSD-2-Clause and BSD-3-Clause licenses are incorrectly flagged as not GPL-compatible
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 22/100
Hướng nghiên cứu
Start in includes/Traits/License_Utils.php, comparing get_normalized_license() (which strips hyphens) with the patterns in is_license_gpl_compatible(), which expect the hyphenated form. Check how Plugin_Header_Fields_Check and Plugin_Readme_Check call them, and extend the existing License_Utils_Tests to cover normalized BSD-2-Clause and BSD-3-Clause input. Done when both licenses pass after normalization. Pull request #1538 is already open against this issue, so review it before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Plugin Check reports BSD-2-Clause and BSD-3-Clause licenses as not GPL-compatible, even though both are GPL-compatible.
Both licenses should pass the check, just like MIT, Apache-2.0, MPL-2.0, and GPL-2.0-or-later.
The issue is in includes/Traits/License_Utils.php, where license normalization and validation do not use the same format.
get_normalized_license()removes hyphens. For example,BSD-3-ClausebecomesBSD3Clause.is_license_gpl_compatible()acceptsBSD-3-ClauseandBSD 3 Clause, but does not recognizeBSD3Clause.- The validation patterns also do not include
BSD-2-Clause.
Both Plugin_Header_Fields_Check and Plugin_Readme_Check normalize the license before they check compatibility. This causes both checks to report the same error.
The existing License_Utils_Tests test uses BSD-3-Clause directly without normalization. Because of this, the test passes but does not catch the issue.
Step-by-step reproduction instructions
- Create a plugin and add
License: BSD-3-Clauseto the plugin header. - Add
License: BSD-3-Clausetoreadme.txt. - Run:
wp plugin check <plugin-slug> - Check the license validation result.
Expected result: Plugin Check accepts both BSD-2-Clause and BSD-3-Clause as GPL-compatible licenses.
Actual result: The compatibility check returns false for both licenses after normalization.
Code snippet
$normalized = $this->get_normalized_license( 'BSD-3-Clause' );
// Returns: BSD3Clause
$this->is_license_gpl_compatible( $normalized );
// Returns: false (expected true)
Environment info
- Plugin Check version: 2.2.0
- Branch: trunk
- Ngôn ngữ chính
- PHP
- Star
- 365
- Fork
- 135
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 20
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của WordPress/plugin-check
-
False positive trademarked_term warning for "wc" inside the word "Flowchart"Có thể đã có người làm @anandrajaram21 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
WordPress/plugin-check#1556 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add opt-in .distignore exclusions for local and CI scansCó thể đã có người làm @jakaria-istauk đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
WordPress/plugin-check#1559 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
WordPress/plugin-check#1557 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
WordPress/plugin-check#1555 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PHPErrorReportingSniff flags debug constants used as values in const declarationsCó thể đã có người làm @elphizu đã nhận 7 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 35/100
WordPress/plugin-check#1553 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của WordPress/plugin-check
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ExpressionEngine/ExpressionEngine#5493 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
"Attempt to read property 'username' on null" error after a user is deletedCó thể đã có người làm @dicksonlaw583 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
omeka/plugin-SimplePages#49 ·
-
Bug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quantum-php/project#222 ·
-
support
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày