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

Appearance settings

Commit c7937c9

Browse filesBrowse files
bug #30034 [Config] ensure moving away from Serializable wont break cache:clear (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [Config] ensure moving away from Serializable wont break cache:clear | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - When a resource implementation moves away from `Serializable`, the `cache:clear` command currently fails with `Warning: Class Symfony\Component\Config\Resource\ClassExistenceResource has no unserializer`. This change makes it ignore the failure, which is fine. Commits ------- 9d3180a [Config] ensure moving away from Serializable wont break cache:clear
2 parents 3cfb558 + 9d3180a commit c7937c9
Copy full SHA for c7937c9

File tree

Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed

‎src/Symfony/Component/Config/ResourceCheckerConfigCache.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/ResourceCheckerConfigCache.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,18 +156,19 @@ private function safelyUnserialize($file)
156156
{
157157
$e = null;
158158
$meta = false;
159+
$content = file_get_contents($file);
159160
$signalingException = new \UnexpectedValueException();
160161
$prevUnserializeHandler = ini_set('unserialize_callback_func', '');
161162
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$prevErrorHandler, $signalingException) {
162-
if (E_WARNING === $type && 'Class __PHP_Incomplete_Class has no unserializer' === $msg) {
163+
if (__FILE__ === $file) {
163164
throw $signalingException;
164165
}
165166

166167
return $prevErrorHandler ? $prevErrorHandler($type, $msg, $file, $line, $context) : false;
167168
});
168169

169170
try {
170-
$meta = unserialize(file_get_contents($file));
171+
$meta = unserialize($content);
171172
} catch (\Error $e) {
172173
} catch (\Exception $e) {
173174
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.