Skip to content
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

[Config] ConfigCache::isFresh() should return false when unserialize() fails #20671

Merged
merged 1 commit into from Nov 29, 2016

Conversation

nicolas-grekas
Copy link
Member

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

Removes some Warning: Class __PHP_Incomplete_Class has no unserializer failures when clearing the cache.

$meta = unserialize(file_get_contents($metadata));
$unserializeCallbackHandler = ini_set('unserialize_callback_func', '');
$signalingException = new \UnexpectedValueException();
set_error_handler(function () use ($signalingException) { throw $signalingException; });
Copy link
Member

Choose a reason for hiding this comment

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

what about other errors happening there due to bugs in the unserialize implementation of Serializable resources ? They would be completely swallowed currently. Shouldn't we try to detect only the case of undefined classes ?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated to return false only when hitting not found classes

@nicolas-grekas nicolas-grekas force-pushed the unser-safe branch 3 times, most recently from c2a5991 to 09132bf Compare November 29, 2016 09:42
@nicolas-grekas nicolas-grekas merged commit 609245e into symfony:2.7 Nov 29, 2016
nicolas-grekas added a commit that referenced this pull request Nov 29, 2016
…nserialize() fails (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Config] ConfigCache::isFresh() should return false when unserialize() fails

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20654
| License       | MIT
| Doc PR        | -

Removes some `Warning: Class __PHP_Incomplete_Class has no unserializer` failures when clearing the cache.

Commits
-------

609245e [Config] ConfigCache::isFresh() should return false on __PHP_Incomplete_Class
@nicolas-grekas nicolas-grekas deleted the unser-safe branch November 29, 2016 13:19
@fabpot fabpot mentioned this pull request Nov 30, 2016
This was referenced Dec 13, 2016
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.

None yet

3 participants