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

Skip to content

[Http-Kernel] [Cache] Warning on deploy with empty cache #36472

Closed
@PatchRanger

Description

@PatchRanger

Symfony version(s) affected: 5.0.7

Description
Each time on deploy, I keep receiving such warning:

Warning: include(.../releases/191/var/cache/prod/App_KernelProdContainer.php): failed to open stream: No such file or directory

How to reproduce
I have Symfony installation with default cache settings. It happens every deploy. So I guess it's enough to just make Symfony bootstrap with cold cache.

Possible Solution
The root and reason is in "include" without suppressing warning as several lines above.
I am going to create PR to fix it.
According to #25999 (comment) as stated in #26158 (comment) , I am going to replace file_exists with the trick of suppressing warning on include as in https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Kernel.php#L431 , turning it into the reusable method.

Additional context

if (!flock($lock, $wouldBlock ? LOCK_SH : LOCK_EX)) {
fclose($lock);
$lock = null;
} elseif (!\is_object($this->container = include $cachePath)) {
$this->container = null;
} elseif (!$oldContainer || \get_class($this->container) !== $oldContainer->name) {
flock($lock, LOCK_UN);
fclose($lock);
$this->container->set('kernel', $this);
return;
}

Looks like regression of: #27234 .

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions