diff --git a/src/Symfony/Component/String/AbstractString.php b/src/Symfony/Component/String/AbstractString.php index 435363b798d25..e56697e391549 100644 --- a/src/Symfony/Component/String/AbstractString.php +++ b/src/Symfony/Component/String/AbstractString.php @@ -692,6 +692,11 @@ public function wordwrap(int $width = 75, string $break = "\n", bool $cut = fals return $str; } + public function __sleep(): array + { + return ['string']; + } + public function __clone() { $this->ignoreCase = false; diff --git a/src/Symfony/Component/String/UnicodeString.php b/src/Symfony/Component/String/UnicodeString.php index 61e8c008dcb35..d7df6f5e1400b 100644 --- a/src/Symfony/Component/String/UnicodeString.php +++ b/src/Symfony/Component/String/UnicodeString.php @@ -347,6 +347,11 @@ public function startsWith($prefix): bool return $prefix === grapheme_extract($this->string, \strlen($prefix), GRAPHEME_EXTR_MAXBYTES); } + public function __wakeup() + { + normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string); + } + public function __clone() { if (null === $this->ignoreCase) {