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
-------
416e40d943
[String] implement __sleep()/__wakeup() on strings
This commit is contained in:
commit
ed3e111e1d
@ -692,6 +692,11 @@ abstract class AbstractString implements \JsonSerializable
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function __sleep(): array
|
||||
{
|
||||
return ['string'];
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->ignoreCase = false;
|
||||
|
@ -347,6 +347,11 @@ class UnicodeString extends AbstractUnicodeString
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user