8000 minor #30965 Prepare for the new serialization mechanism (fancyweb) · symfony/validator@22014b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 22014b5

Browse files
committed
minor #30965 Prepare for the new serialization mechanism (fancyweb)
This PR was merged into the 4.3-dev branch. Discussion ---------- Prepare for the new serialization mechanism | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - #eufossa Should I maybe split this component by component ? https://wiki.php.net/rfc/custom_object_serialization has been accepted. Best viewed in "split" mode. This work is kind of required for symfony/symfony#30304 so we don't trigger 30 deprecations from our own code base. Commits ------- d412e77a9c Prepare for the new serialization mechanism
2 parents 03c80bd + ee5b7ee commit 22014b5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Tests/Fixtures/CustomArrayObject.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,23 @@ public function count()
5858
return \count($this->array);
5959
}
6060

61+
public function __serialize(): array
62+
{
63+
return $this->array;
64+
}
65+
6166
public function serialize()
6267
{
63-
return serialize($this->array);
68+
return serialize($this->__serialize());
69+
}
70+
71+
public function __unserialize(array $data): void
72+
{
73+
$this->array = $data;
6474
}
6575

6676
public function unserialize($serialized)
6777
{
68-
$this->array = (array) unserialize((string) $serialized);
78+
$this->__unserialize((array) unserialize((string) $serialized));
6979
}
7080
}

0 commit comments

Comments
 (0)
0