From 5d8aa9ecb45080ed4658e8daa4e0f765442a7a3d Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 11 Apr 2022 17:55:36 +0300 Subject: [PATCH] Added definition of hex whitespace symbol on Str::squish() --- 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 691a1d4b4716..6a82df408835 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -889,7 +889,7 @@ public static function snake($value, $delimiter = '_') */ public static function squish($value) { - return preg_replace('~\s+~u', ' ', preg_replace('~^\s+|\s+$~u', '', $value)); + return preg_replace('~(\s|\x{3164})+~u', ' ', preg_replace('~^\s+|\s+$~u', '', $value)); } /** diff --git a/tests/Support/SupportStrTest.php b/tests/Support/SupportStrTest.php index ec93086caba5..26a8b749f456 100755 --- a/tests/Support/SupportStrTest.php +++ b/tests/Support/SupportStrTest.php @@ -553,6 +553,7 @@ public function testSquish() $this->assertSame('ム', Str::squish('ム')); $this->assertSame('だ', Str::squish('  だ   ')); $this->assertSame('ム', Str::squish('  ム   ')); + $this->assertSame('laravel php framework', Str::squish('laravelㅤㅤㅤphpㅤframework')); } public function testStudly()