8000 bug #30034 [Config] ensure moving away from Serializable wont break c… · symfony/symfony@c7937c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7937c9

Browse 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

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Symfony/Component/Config/ResourceCheckerConfigCache.php

Lines 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