From 188b3a35c8d2a2a32a23f18b6b628696cb0eeff6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 9 Jan 2018 17:29:30 +0100 Subject: [PATCH] Tweak license deprecation text to handle + more gracefully, fixes #6981 --- src/Composer/Package/Loader/ValidatingArrayLoader.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index 68279d539..0713a2fe5 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -125,7 +125,12 @@ class ValidatingArrayLoader implements LoaderInterface foreach ($licenses as $license) { $spdxLicense = $licenseValidator->getLicenseByIdentifier($license); if ($spdxLicense && $spdxLicense[3]) { - if (preg_match('{^[AL]?GPL-[123](\.[01])?\+?$}i', $license)) { + if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) { + $this->warnings[] = sprintf( + 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead', + $license + ); + } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) { $this->warnings[] = sprintf( 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead', $license