From 6e6fb844ddb35868f04c6db9d40b6b24cc6ad31a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 26 Nov 2018 12:59:54 +0100 Subject: [PATCH] Avoid validating package name if it has a newline at the end --- src/Composer/Command/InitCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 515a16943..3022360ee 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -214,7 +214,7 @@ EOT } $name = strtolower($name); } else { - if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) { + if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) { throw new \InvalidArgumentException( 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+' ); @@ -228,7 +228,7 @@ EOT return $name; } - if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) { + if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) { throw new \InvalidArgumentException( 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+' );