Skip to content
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

Check file existence before filemtime #20260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions framework/caching/FileCache.php
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ public function exists($key)
{
$cacheFile = $this->getCacheFile($this->buildKey($key));

return @filemtime($cacheFile) > time();
return file_exists($cacheFile) && @filemtime($cacheFile) > time();
}

/**
@@ -110,7 +110,7 @@ protected function getValue($key)
{
$cacheFile = $this->getCacheFile($key);

if (@filemtime($cacheFile) > time()) {
if (file_exists($cacheFile) && @filemtime($cacheFile) > time()) {
$fp = @fopen($cacheFile, 'r');
if ($fp !== false) {
@flock($fp, LOCK_SH);

Unchanged files with check annotations Beta

{
if (is_array($newValue) && is_array($oldValue)) {
// Only sort associative arrays
$sorter = function(&$array) {

Check failure on line 1786 in framework/db/BaseActiveRecord.php

GitHub Actions / PHP_CodeSniffer

Expected 1 space after FUNCTION keyword; 0 found
if (ArrayHelper::isAssociative($array)) {
ksort($array);
}
return Yii::createObject(ColumnSchemaBuilder::className(), [$type, $length, $this->db]);
}
}

Check failure on line 827 in framework/db/mssql/Schema.php

GitHub Actions / PHP_CodeSniffer

The closing brace for the class must go on the next line after the body