Skip to content
Permalink
Browse files

bug #21731 Fix emacs link (rubenrua)

This PR was merged into the 2.7 branch.

Discussion
----------

Fix emacs link

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes (minor)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

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 [the Emacs' PID][1].

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]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html

Commits
-------

c6f7ca6 Fix RuntimeException when an Emacs buffer is modified
  • Loading branch information...
fabpot committed Mar 1, 2017
2 parents 908d470 + c6f7ca6 commit ffc1cd507bccfb85746208ba1cc4ff1b15e16061
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/Symfony/Component/Config/Resource/DirectoryResource.php
@@ -84,8 +84,15 @@ public function isFresh($timestamp)
continue;
}
// for broken links
try {
$fileMTime = $file->getMTime();
} catch (\RuntimeException $e) {
continue;
}
// early return if a file's mtime exceeds the passed timestamp
if ($timestamp < $file->getMTime()) {
if ($timestamp < $fileMTime) {
return false;
}
}

0 comments on commit ffc1cd5

Please sign in to comment.
You can’t perform that action at this time.