Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Drop more usages of Serializable#30286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedFeb 18, 2019
edited
Loading

QA
Branch?master
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

When the serialized payload of some class is used for ephemeral needs, my proposal here is to drop implementingSerializable and provide a deprecation layer based on__sleep to still call theserialize/unserialize methods. This means that at the behavior level, we provide BC, and at the payload level, we don't.

That leaves us with only two "not ephemeral" use cases:

  • Route andCompilerRoute instances are serialized by Drupal. We'd better not break such existing payloads without being sure it's ok for Drupal (ping@alexpott). My proposal in this PR is to schedule the BC break for Symfony 5, and ask Drupal (and others) to add a check in their unserialization logic so that they are able to recompile the cached list of routes if unserialize fails due to this change. They could alternatively implementSerializable on their own, without callingparent::(un)serialize().
  • TokenInterface fromSecurity - for this one, I have no idea yet, except either plan for breaking BC at the payload level (which would mean invalidating all sessions when moving to SF5) - or create a new interface if we think breaking sessions is not reasonable. For now, I've kept usingSerializable, which could be also fine keeping if we mark the corresponding methodfinal to force

WDYT?

@OskarStark
Copy link
Contributor

Typo:
This leaves us WITH....

nicolas-grekas reacted with thumbs up emoji

@alexpott
Copy link
Contributor

Drupal extendsCompilerRoute and overrides both::serialize and::unserialize. We can rebuild our router so the change to the payload should be okay.

@nicolas-grekas
Copy link
MemberAuthor

@alexpott thanks, then the plan for Drupal should be to stop callingparent::serialize()/unserialize() asap and explicitly declareimplements \Serializable. Then you'd preserve full forward and backward compat.

@nicolas-grekasnicolas-grekasforce-pushed thedrop-more-serializable branch 3 times, most recently from37674f1 to66b50bfCompareFebruary 20, 2019 08:39
Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would remove the possibility to serialize a Kernel as I don't see (anymore) the use cases.

@nicolas-grekasnicolas-grekasforce-pushed thedrop-more-serializable branch 3 times, most recently from966d44a to856ae9fCompareFebruary 23, 2019 16:48
@nicolas-grekas
Copy link
MemberAuthor

I would remove the possibility to serialize a Kernel as I don't see (anymore) the use cases.

Actually, that's not possible: the kernel is serialized in FrameworkBundle for insulated tests, see

$kernel =var_export(serialize($this->kernel),true);

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit05d6475 intosymfony:masterMar 4, 2019
fabpot added a commit that referenced this pull requestMar 4, 2019
This PR was merged into the 4.3-dev branch.Discussion----------Drop more usages of Serializable| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -When the serialized payload of some class is used for ephemeral needs, my proposal here is to drop implementing `Serializable` and provide a deprecation layer based on `__sleep` to still call the `serialize`/`unserialize` methods. This means that at the behavior level, we provide BC, and at the payload level, we don't.That leaves us with only two "not ephemeral" use cases:- `Route` and `CompilerRoute` instances are serialized by Drupal. We'd better not break such existing payloads without being sure it's ok for Drupal (ping@alexpott). My proposal in this PR is to schedule the BC break for Symfony 5, and ask Drupal (and others) to add a check in their unserialization logic so that they are able to recompile the cached list of routes if unserialize fails due to this change. They could alternatively implement `Serializable` on their own, without calling `parent::(un)serialize()`.- `TokenInterface` from `Security` - for this one, I have no idea yet, except either plan for breaking BC at the payload level (which would mean invalidating all sessions when moving to SF5) - or create a new interface if we think breaking sessions is not reasonable. For now, I've kept using `Serializable`, which could be also fine keeping if we mark the corresponding method `final` to forceWDYT?Commits-------05d6475 Drop more usages of Serializable
@nicolas-grekasnicolas-grekas deleted the drop-more-serializable branchMarch 4, 2019 10:52
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
@fabpotfabpot mentioned this pull requestMay 9, 2019
@Tobion
Copy link
Contributor

@alexpott FYI#31866

Tobion added a commit that referenced this pull requestJun 5, 2019
…(Tobion)This PR was merged into the 4.3 branch.Discussion----------[Routing] revert deprecation of Serializable in routing| Q             | A| ------------- | ---| Branch?       | 4.3| Bug fix?      | no| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets || License       | MIT| Doc PR        |we still need to implement Serializable as long as we support PHP < 7.4. otherwise serialized data in php 7.2 would not work anymore when people upgrade to php 7.4. see discussion in#31792 (comment)partly reverts#30286Commits-------d32a295 [Routing] revert deprecation of Serializable in routing
nicolas-grekas added a commit that referenced this pull requestJun 5, 2019
This PR was merged into the 5.0-dev branch.Discussion----------[Routing] remove deprecations| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->| BC breaks?    | yes     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets || License       | MIT| Doc PR        |Ref.#30249,#30286,#24894Commits-------5beb5f8 [Routing] remove deprecations
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@fabpotfabpotfabpot approved these changes

@chalasrchalasrchalasr approved these changes

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

8 participants

@nicolas-grekas@OskarStark@alexpott@fabpot@Tobion@javiereguiluz@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp