Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix GlobResource serialization #29062

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
Nov 2, 2018
Merged

Fix GlobResource serialization #29062

merged 1 commit into from
Nov 2, 2018

Conversation

alexismarquis
Copy link
Contributor

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? no
Fixed tickets #28200
License MIT
Doc PR

Since @gonzalovilaseca improvement in PR #28200, I noticed that the container is being compiled systematically. This is caused by the two added properties (forExclusion, excludedPrefixes) not being serialized, and lead to wrong hash computing. I updated the serialize and unserialize methods in this PR.

ping @nicolas-grekas

@nicolas-grekas nicolas-grekas added this to the 4.2 milestone Nov 2, 2018
@gonzalovilaseca
Copy link
Contributor

Great catch, is it worth adding a test to avoid this happening in the future?

@nicolas-grekas
Copy link
Member

How can we write a test that would catch this if we add more properties in the future?
$this->assertEquals($resource, unserialize(serialize($resource)) wouldn't catch it, unless we add random values in each properties... - which runs in circle since this would require knowing the properties (and thus fail the prevention we're looking for)...
Merging now, PR welcome with extra tests if one wants to resolve this (I don't have the solution :) )

@nicolas-grekas
Copy link
Member

Good catch, thanks @alexismarquis.

@nicolas-grekas nicolas-grekas merged commit 6ce7f07 into symfony:master Nov 2, 2018
nicolas-grekas added a commit that referenced this pull request Nov 2, 2018
This PR was squashed before being merged into the 4.2-dev branch (closes #29062).

Discussion
----------

Fix GlobResource serialization

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | no    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #28200   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | <!-- required for new features -->

Since @gonzalovilaseca improvement in PR #28200, I noticed that the container is being compiled systematically. This is caused by the two added properties (`forExclusion`, `excludedPrefixes`) not being serialized, and lead to wrong hash computing. I updated the `serialize` and `unserialize` methods in this PR.

ping @nicolas-grekas

Commits
-------

6ce7f07 Fix GlobResource serialization
@gonzalovilaseca
Copy link
Contributor

Dunno, I was just suggesting!! :-)

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