8000 Fix RuntimeException when an Emacs buffer is modified · symfony/symfony@7c01924 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7c01924

Browse files
committed
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); ```
1 parent 8201e47 commit 7c01924

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Symfony/Component/Config/Resource/DirectoryResource.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,15 @@ public function isFresh($timestamp)
8484
continue;
8585
}
8686

87+
// for broken links
88+
try {
89+
$fileMTime = $file->getMTime();
90+
} catch (\RuntimeException $e) {
91+
continue;
92+
}
93+
8794
// early return if a file's mtime exceeds the passed timestamp
88-
if ($timestamp < $file->getMTime()) {
95+
if ($timestamp < $fileMTime) {
8996
return false;
9097
}
9198
}

0 commit comments

Comments
 (0)
0