bug #21211 Classloader tmpname (lyrixx)
This PR was merged into the 2.7 branch.
Discussion
----------
Classloader tmpname
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
In dev env:
from:
> Notice: tempnam(): file created in the system's temporary directory
to:
> Failed to write cache file "/var/www/html/var/cache/dev/classes.php".
Commits
-------
3c887da4f3
[ClassLoader] Throw an exception if the cache is not writeable
This commit is contained in:
commit
e9f2512c04
|
@ -275,7 +275,13 @@ REGEX;
|
|||
*/
|
||||
private static function writeCacheFile($file, $content)
|
||||
{
|
||||
$tmpFile = tempnam(dirname($file), basename($file));
|
||||
$dir = dirname($file);
|
||||
if (!is_writable($dir)) {
|
||||
throw new \RuntimeException(sprintf('Cache directory "%s" is not writable.', $dir));
|
||||
}
|
||||
|
||||
$tmpFile = tempnam($dir, basename($file));
|
||||
|
||||
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
|
||||
@chmod($file, 0666 & ~umask());
|
||||
|
||||
|
|
Reference in New Issue