Skip to content

Commit 0b171a3

Browse files
bug #39795 Dont allow unserializing classes with a destructor - 5.1 (jderusse)
This PR was merged into the 5.1 branch. Discussion ---------- Dont allow unserializing classes with a destructor - 5.1 | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Prevent destructors with side-effects from being unserialized Commits ------- 07402f4af3 Dont allow unserializing classes with a destructor - 5.1
2 parents 760c239 + cb694db commit 0b171a3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

UnicodeString.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ public function startsWith($prefix): bool
359359

360360
public function __wakeup()
361361
{
362+
if (!\is_string($this->string)) {
363+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
364+
}
365+
362366
normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
363367
}
364368

0 commit comments

Comments
 (0)