Skip to content

Commit

Permalink
bug #39795 Dont allow unserializing classes with a destructor - 5.1 (…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
nicolas-grekas committed Jan 12, 2021
2 parents 760c239 + cb694db commit 0b171a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions UnicodeString.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ public function startsWith($prefix): bool

public function __wakeup()
{
if (!\is_string($this->string)) {
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}

normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
}

Expand Down

0 comments on commit 0b171a3

Please sign in to comment.