Skip to content

Commit c248521

Browse files
committed
prevent insecure characters in locale
1 parent 5b7f541 commit c248521

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Illuminate/Translation/Translator.php

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\Support\NamespacedItemResolver;
1111
use Illuminate\Support\Str;
1212
use Illuminate\Support\Traits\Macroable;
13+
use InvalidArgumentException;
1314

1415
class Translator extends NamespacedItemResolver implements TranslatorContract
1516
{
@@ -406,6 +407,10 @@ public function getLocale()
406407
*/
407408
public function setLocale($locale)
408409
{
410+
if (Str::contains($locale, ['.', '/', '\\'])) {
411+
throw new InvalidArgumentException('Invalid characters present in locale.');
412+
}
413+
409414
$this->locale = $locale;
410415
}
411416

0 commit comments

Comments
 (0)