Fix RuntimeException when an Emacs buffer is modified
When an Emacs buffer is modified, by default Emacs automatically creates a temporary symlink in the same directory as the file being edited (e.g. Controller.php): ``` .#Controller.php -> user@host.12345:1296583136 ``` where '12345' is Emacs' PID. In this case Symfony breaks with a RuntimeException: ``` SplFileInfo::getMTime(): stat failed for ...Bundle/Controller/.#APIController.php ``` in vendor/symfony/symfony/src/Symfony/Component/Config/Resource/DirectoryResource.php at line 89 ``` $newestMTime = max($file->getMTime(), $newestMTime); ```
This commit is contained in:
parent
eb750be851
commit
c6f7ca6fa1
@ -84,8 +84,15 @@ class DirectoryResource implements ResourceInterface, \Serializable
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for broken links
|
||||||
|
try {
|
||||||
|
$fileMTime = $file->getMTime();
|
||||||
|
} catch (\RuntimeException $e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// early return if a file's mtime exceeds the passed timestamp
|
// early return if a file's mtime exceeds the passed timestamp
|
||||||
if ($timestamp < $file->getMTime()) {
|
if ($timestamp < $fileMTime) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user