BSD-2-Clause and BSD-3-Clause licenses are incorrectly flagged as not GPL-compatible
维护者通常 1 天内回复
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- PHP
- 星标
- 365
- 派生
- 135
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 20
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
WordPress/plugin-check 的其他 Issue
-
False positive trademarked_term warning for "wc" inside the word "Flowchart"可能已有人在做 @anandrajaram21 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
WordPress/plugin-check#1556 · 1 条评论 ·
维护者通常 1 天内回复
-
Add opt-in .distignore exclusions for local and CI scans可能已有人在做 @jakaria-istauk 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 42/100
WordPress/plugin-check#1559 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 58/100
WordPress/plugin-check#1557 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
WordPress/plugin-check#1555 · 1 条评论 ·
维护者通常 1 天内回复
-
PHPErrorReportingSniff flags debug constants used as values in const declarations可能已有人在做 @elphizu 于 7 天前认领。 未关闭
难度 3/5 半天 新手友好度 35/100
WordPress/plugin-check#1553 ·
维护者通常 1 天内回复
查看 WordPress/plugin-check 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
ExpressionEngine/ExpressionEngine#5493 ·
维护者通常 5 天内回复
-
"Attempt to read property 'username' on null" error after a user is deleted可能已有人在做 @dicksonlaw583 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
omeka/plugin-SimplePages#49 ·
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 76/100
quantum-php/project#222 ·
-
support
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复