diff --git a/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php b/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php index f5ad195b0325..b82bdbfa8127 100644 --- a/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php +++ b/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php @@ -4,6 +4,7 @@ use Closure; use Illuminate\Support\Arr; +use Illuminate\Support\Str; class TrimStrings extends TransformsRequest { @@ -65,7 +66,7 @@ protected function transform($key, $value) return $value; } - return preg_replace('~^[\s\x{FEFF}\x{200B}]+|[\s\x{FEFF}\x{200B}]+$~u', '', $value) ?? trim($value); + return Str::trim($value); } /**