8000 bug #34801 [String] implement __sleep()/__wakeup() on strings (nicola… · symfony/symfony@ed3e111 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed3e111

Browse files
committed
bug #34801 [String] implement __sleep()/__wakeup() on strings (nicolas-grekas)
This PR was merged into the 5.0 branch. Discussion ---------- [String] implement __sleep()/__wakeup() on strings | Q | A | ------------- | --- | Branch? | 5.0 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This resets the transient ignoreCase state on unserialized instances. Commits ------- 416e40d [String] implement __sleep()/__wakeup() on strings
2 parents b3f513a + 416e40d commit ed3e111

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Symfony/Component/String/AbstractString.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,11 @@ public function wordwrap(int $width = 75, string $break = "\n", bool $cut = fals
692692
return $str;
693693
}
694694

695+
public function __sleep(): array
696+
{
697+
return ['string'];
698+
}
699+
695700
public function __clone()
696701
{
697702
$this->ignoreCase = false;

src/Symfony/Component/String/UnicodeString.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,11 @@ public function startsWith($prefix): bool
347347
return $prefix === grapheme_extract($this->string, \strlen($prefix), GRAPHEME_EXTR_MAXBYTES);
348348
}
349349

350+
public function __wakeup()
351+
{
352+
normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
353+
}
354+
350355
public function __clone()
351356
{
352357
if (null === $this->ignoreCase) {

0 commit comments

Comments
 (0)
0