BSD-2-Clause and BSD-3-Clause licenses are incorrectly flagged as not GPL-compatible
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 22/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- PHP
- Stelle
- 365
- Fork
- 135
- Merge medio
- 1g 8h
- PR unite (30g)
- 20
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di WordPress/plugin-check
-
False positive trademarked_term warning for "wc" inside the word "Flowchart"Forse già presa @anandrajaram21 l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
WordPress/plugin-check#1556 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add opt-in .distignore exclusions for local and CI scansForse già presa @jakaria-istauk l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
WordPress/plugin-check#1559 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
WordPress/plugin-check#1557 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
WordPress/plugin-check#1555 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
PHPErrorReportingSniff flags debug constants used as values in const declarationsForse già presa @elphizu l’ha presa 7 giorni fa. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 35/100
WordPress/plugin-check#1553 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di WordPress/plugin-check
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ExpressionEngine/ExpressionEngine#5493 ·
I maintainer di solito rispondono entro 5 giorni
-
"Attempt to read property 'username' on null" error after a user is deletedForse già presa @dicksonlaw583 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
omeka/plugin-SimplePages#49 ·
-
Bug Status: Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
quantum-php/project#222 ·
-
support
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno