Skip to content

[VarExporter] unserialize() might throw an Exception on php 8 #38101

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
Sep 8, 2020

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Sep 7, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets #36872
License MIT
Doc PR N/A

VarExporter attempts a deserialization in order to check if a given object can be exported in serialized form. On php 8, the unserialize call might throw an exception that needs to be caught and converted to the expected NotInstantiableTypeException.

@nicolas-grekas
Copy link
Member

Do you have an exemple of that on php 8? Worth a test case?

@derrabus
Copy link
Member Author

derrabus commented Sep 7, 2020

We have a failing test already, see https://travis-ci.org/github/symfony/symfony/jobs/724971294, line 5020.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Sep 7, 2020

I'd prefer being very specific about the reason of the exception. Maybe using getFilename()?

@derrabus derrabus force-pushed the bugfix/unserialize-throws branch from a75896d to d9802da Compare September 7, 2020 21:08
@derrabus
Copy link
Member Author

derrabus commented Sep 7, 2020

Sounds like a good idea. I've added a check.

@derrabus derrabus force-pushed the bugfix/unserialize-throws branch from d9802da to 65112e1 Compare September 7, 2020 21:10
@chalasr chalasr modified the milestones: 3.4, 4.4 Sep 7, 2020
@nicolas-grekas
Copy link
Member

Thank you @derrabus.

@nicolas-grekas nicolas-grekas merged commit f8fddf3 into symfony:4.4 Sep 8, 2020
@derrabus derrabus deleted the bugfix/unserialize-throws branch September 8, 2020 07:44
This was referenced Sep 27, 2020
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.

4 participants