8000 Optimize assertLocale regexp · symfony/symfony@537c39b · GitHub
[go: up one dir, main page]

Skip to content

Commit 537c39b

Browse files
author
Jérémy Derussé
committed
Optimize assertLocale regexp
1 parent 9572918 commit 537c39b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Translation/Translator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ protected function computeFallbackLocales($locale)
308308
*/
309309
private function assertValidLocale($locale)
310310
{
311-
if (0 !== preg_match('/[^a-z0-9@_\\.\\-]+/i', $locale, $match)) {
311+
if (1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) {
312312
throw new \InvalidArgumentException(sprintf('Invalid locale: %s.', $locale));
313313
}
314314
}

0 commit comments

Comments
 (0)
0