Skip to content

Commit 85b7f4a

Browse files
bug symfony#61729 [PhpUnitBridge] Silence deprecation of __sleep/wakeup() (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [PhpUnitBridge] Silence deprecation of __sleep/wakeup() | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT This change is required to make our CI green on branches that didn't migrate out of the phpunit-bridge, which means 6.4 and 7.3. By the time PHP 8.5 will be really adopted, ppl will have moved away from Symfony 6.4/7.3 anyway (or will need to deal with the deprecations on their own). I already wrote a lot about ways to fix this deprecation, and it's not trivial, so that ignoring is the best course of action. As a reminder, branch 7.4 moved away from those magic methods already. Commits ------- 4dbc8dd [PhpUnitBridge] Silence deprecation of __sleep/wakeup()
2 parents 92a6bd1 + 4dbc8dd commit 85b7f4a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ public function handleError($type, $msg, $file, $line, $context = [])
171171
exit(1);
172172
}
173173

174+
if (\PHP_VERSION_ID >= 80500 && \in_array($msg, [
175+
'The __sleep() serialization magic method has been deprecated. Implement __serialize() instead (or in addition, if support for old PHP versions is necessary)',
176+
'The __wakeup() serialization magic method has been deprecated. Implement __unserialize() instead (or in addition, if support for old PHP versions is necessary)',
177+
], true)) {
178+
return null;
179+
}
180+
174181
if ('legacy' === $group) {
175182
$this->deprecationGroups[$group]->addNotice();
176183
} elseif ($deprecation->originatesFromAnObject()) {

0 commit comments

Comments
 (0)