From d0376ff15f5b3f0fcf5dc173d4032cbf3024120f Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 1 Apr 2023 15:36:00 +0300 Subject: [PATCH] [10.x] Added empty string definition to `Str::squish` function --- src/Illuminate/Support/Str.php | 2 +- tests/Support/SupportStrTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 53ef36b7c89e..71e2bee08d26 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -1151,7 +1151,7 @@ public static function snake($value, $delimiter = '_') */ public static function squish($value) { - return preg_replace('~(\s|\x{3164})+~u', ' ', preg_replace('~^[\s\x{FEFF}]+|[\s\x{FEFF}]+$~u', '', $value)); + return preg_replace('~(\s|\x{3164}|\x{1160})+~u', ' ', preg_replace('~^[\s\x{FEFF}]+|[\s\x{FEFF}]+$~u', '', $value)); } /** diff --git a/tests/Support/SupportStrTest.php b/tests/Support/SupportStrTest.php index bc3c65e9b002..8d7c748a4e6b 100755 --- a/tests/Support/SupportStrTest.php +++ b/tests/Support/SupportStrTest.php @@ -672,6 +672,7 @@ public function testSquish() $this->assertSame('だ', Str::squish('  だ   ')); $this->assertSame('ム', Str::squish('  ム   ')); $this->assertSame('laravel php framework', Str::squish('laravelㅤㅤㅤphpㅤframework')); + $this->assertSame('laravel php framework', Str::squish('laravelᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠphpᅠᅠframework')); } public function testStudly()