Skip to content

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Sep 11, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

This PR replaces __sleep/wakeup() by __(un)serialize(), for throwing and internal usages.

This follows the merge of php/php-src#19435

While this change on 8.5 might be reverted (see https://wiki.php.net/rfc/soft-deprecate-sleep-wakeup), we can still remove all those cases.

This DOES NOT replace all use cases of __sleep/wakeup(). We did so already on branch 7.4, but doing it on branch 6.4 is another story. This would basically be way to risky IMHO, with a bunch of non-trivial code to add just to fix the deprecation.

My recommendation for those remaining use cases is to ignore the deprecation. By the time ppl will move to PHP 8.5, they will also move away from Symfony 6.4

I'll submit another PR to the phpunit-bridge for that.

For the record, here is the list of files/classes that cannot be "just" migrated to __(un)serialize()
(I'll let the reader wonder about how they could be - and compare their ideas to what we did in 7.4):

  • src/Symfony/Component/HttpKernel/Profiler/Profile.php
  • src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
  • src/Symfony/Component/HttpKernel/Kernel.php
  • src/Symfony/Component/String/AbstractString.php
  • src/Symfony/Component/String/LazyString.php
  • src/Symfony/Component/Mime/Part/SMimePart.php
  • src/Symfony/Component/Mime/Part/TextPart.php
  • src/Symfony/Component/Mime/Part/DataPart.php
  • src/Symfony/Component/Validator/Constraint.php
  • src/Symfony/Component/Validator/Mapping/GenericMetadata.php
  • src/Symfony/Component/Validator/Mapping/MemberMetadata.php
  • src/Symfony/Component/Validator/Mapping/ClassMetadata.php
  • src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php
  • src/Symfony/Component/Serializer/Mapping/ClassMetadata.php

@carsonbot carsonbot added this to the 6.4 milestone Sep 11, 2025
@carsonbot carsonbot changed the title Replace __sleep/wakeup() by __(un)serialize() for throwing and internal usages Replace __sleep/wakeup() by __(un)serialize() for throwing and internal usages Sep 11, 2025
@nicolas-grekas nicolas-grekas force-pushed the sleep-throw branch 2 times, most recently from ef6aeb6 to f068888 Compare September 11, 2025 09:53
@nicolas-grekas nicolas-grekas merged commit 92a6bd1 into symfony:6.4 Sep 11, 2025
9 of 12 checks passed
@nicolas-grekas nicolas-grekas deleted the sleep-throw branch September 11, 2025 10:08
This was referenced Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants