Skip to content

Commit

Permalink
Optimize assertLocale regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérémy Derussé committed Jul 22, 2014
1 parent 9572918 commit 537c39b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Translation/Translator.php
Expand Up @@ -308,7 +308,7 @@ protected function computeFallbackLocales($locale)
*/
private function assertValidLocale($locale)
{
if (0 !== preg_match('/[^a-z0-9@_\\.\\-]+/i', $locale, $match)) {
if (1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) {
throw new \InvalidArgumentException(sprintf('Invalid locale: %s.', $locale));
}
}
Expand Down

0 comments on commit 537c39b

Please sign in to comment.