mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-20 18:32:59 +08:00
Fixes #4820: Fixed reading incomplete debug index data in case of high request concurrency
This commit is contained in:
@ -118,7 +118,17 @@ class DefaultController extends Controller
|
||||
clearstatcache();
|
||||
}
|
||||
$indexFile = $this->module->dataPath . '/index.data';
|
||||
if (is_file($indexFile) && is_readable($indexFile) && ($content = file_get_contents($indexFile)) !== false) {
|
||||
|
||||
$content = '';
|
||||
$fp = @fopen($indexFile, 'r');
|
||||
if ($fp !== false) {
|
||||
@flock($fp, LOCK_SH);
|
||||
$content = fread($fp, filesize($indexFile));
|
||||
@flock($fp, LOCK_UN);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($content !== '') {
|
||||
$this->_manifest = array_reverse(unserialize($content), true);
|
||||
} else {
|
||||
$this->_manifest = [];
|
||||
|
Reference in New Issue
Block a user