10000 Remove Serializable implementations by derrabus · Pull Request #41299 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Remove Serializable implementations #41299

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2021

Conversation

derrabus
Copy link
Member
Q A
Branch? 6.0
Bug fix? no
New feature? no
Deprecations? no
Tickets Fix #41094
License MIT
Doc PR N/A

@carsonbot
Copy link

Hey!

I think @fancyweb has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@derrabus derrabus force-pushed the remove/serializable branch from 0ea5767 to b3fb841 Compare May 20, 2021 21:13
@nicolas-grekas
Copy link
Member

SwitchUserToken has no unserializer

test failure look related

@derrabus derrabus force-pushed the remove/serializable branch from b3fb841 to ddf1d73 Compare May 23, 2021 12:39
@derrabus
Copy link
Member Author

It is indeed.

The failing test checks if a SwitchUserToken that has been serialized with Symfony 4.4 and PHP 7.2 (I think) can still be unserialized. This does not work anymore because on PHP 7.2, the Serializable interface is used and if we remove that interface, PHP does not know how to unserialize the data. The test will fail again if we remove the deprecated User class because the serialized fixture uses it.

I think, the gap is too large here. I would not expect that I can jump from Symfony 4.4 and PHP 7.2 to Symfony 6.0 and PHP 8.0 directly and resume old sessions.

I would regenerate the fixture with InMemoryUser on Symfony 5.3 and PHP 8 and update the test accordingly. Would that be okay?

@derrabus derrabus force-pushed the remove/serializable branch from ddf1d73 to 02d9820 Compare May 23, 2021 13:18
@derrabus
Copy link
Member Author

🤔 Let's get that deprecated user out of that fixture first. #41385

@derrabus
Copy link
Member Author

Now that the deprecated fixture is out of the way, I could regenerate the fixture on PHP 8. This way, an app could still jump from Symfony 4.4 to 6.0 directly, if PHP is not upgraded at the same time. I'm going to document this is the upgrade notes.

@derrabus derrabus force-pushed the remove/serializable branch from 02d9820 to e1b93d6 Compare May 23, 2021 18:27
@nicolas-grekas
Copy link
Member

Route has no unserializer

one more :)

@derrabus derrabus force-pushed the remove/serializable branch from e1b93d6 to d6b8605 Compare May 24, 2021 12:57
@derrabus
Copy link
Member Author

one more :)

Fixed. I regenerated the fixture with Symfony 4.4 and PHP 8:

$newFixture = serialize(unserialize($oldFixture));

What is the use-case for serializing routes? I'd like to write an upgrade note here as well.

@nicolas-grekas
Copy link
Member

I think Drupal stores the routes in the DB.

@derrabus
Copy link
Member Author

Oh, I see. In that case, Drupal needs to provide a way to migrate database tables storing serialized routes after a PHP upgrade (if that does not happen already), ideally before they release a version with Symfony 6 support. Is there someone we can contact about that?

@nicolas-grekas
Copy link
Member

/cc @alexpott

@nicolas-grekas
Copy link
Member

As discussed in #41094 (comment), we should keep the interface on implementations (not on interfaces), but they should be final and internal, and only unserialize() should have an implementation: serialize() should throw a BadMethodCall instead

@nicolas-grekas
Copy link
Member

Thank you @derrabus.

@nicolas-grekas nicolas-grekas merged commit a2d1e80 into symfony:6.0 May 27, 2021
@derrabus derrabus deleted the remove/serializable branch May 27, 2021 15:43
@derrabus
Copy link
Member Author

Thank you for resuming my work. 🙂

@fabpot fabpot mentioned this pull request Nov 5, 2021
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.

3 participants
0