Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ed3e111

Browse filesBrowse 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
Copy full SHA for ed3e111

File tree

2 files changed

+10
-0
lines changed
Filter options

2 files changed

+10
-0
lines changed

‎src/Symfony/Component/String/AbstractString.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/String/AbstractString.php
+5Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/String/UnicodeString.php
+5Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.