8000 [HttpKernel] [Kernel] Silence failed deprecations logs writes by fancyweb · Pull Request #40104 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpKernel] [Kernel] Silence failed deprecations logs writes #40104

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

Conversation

fancyweb
Copy link
Contributor
@fancyweb fancyweb commented Feb 5, 2021
Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

When ->buildContainer() throws because the cache directory cannot be created, we still try to write the deprecations logs inside the cache directory. In this case, the final exception is Warning: file_put_contents(/app/var/cache/dev/App_KernelDevDebugContainerDeprecations.log): failed to open stream: No such file or directory instead of Unable to create the "cache" directory (/app/var/cache/dev)..

Alternative:

try {
    // ...
} catch (\RuntimeException $e)
} finally {
    if (isset($e)) {
        throw $e;
    }

    // ...
}

@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

@nicolas-grekas nicolas-grekas merged commit 71ca1f3 into symfony:4.4 Feb 5, 2021
@fancyweb fancyweb deleted the http-kernel/silence-deprecations-log-fail branch February 5, 2021 16:04
This was referenced Mar 4, 2021
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.

3 participants
0