1
0
Fork 0

Avoid validating package name if it has a newline at the end

pull/7806/head
Jordi Boggiano 2018-11-26 12:59:54 +01:00
parent 42e88ac27a
commit 6e6fb844dd
1 changed files with 2 additions and 2 deletions

View File

@ -214,7 +214,7 @@ EOT
} }
$name = strtolower($name); $name = strtolower($name);
} else { } 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( 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_.-]+' '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; 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( 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_.-]+' '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_.-]+'
); );