-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fix emacs link #21731
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
Fix emacs link #21731
Conversation
Applies to 2.7, isn't it? |
Yes, new pull request? |
@rubenrua No need for a new PR. You can rebase your changes onto the |
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); ```
7c01924
to
c6f7ca6
Compare
Rebase done |
@@ -84,8 +84,15 @@ public function isFresh($timestamp) | |||
continue; | |||
} | |||
|
|||
// for broken links | |||
try { | |||
$fileMTime = $file->getMTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does getMTime()
from PHP throws a RuntimeException
? If yes, since which version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All PHP versions since 5.3
.
symlink('/tmp/target_not_exists', '/tmp/link');
$file = new SplFileInfo('/tmp/link');
var_dump($file->getMTime());
Thank you @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
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):
where '12345' is the Emacs' PID.
In this case Symfony breaks with a RuntimeException:
in
vendor/symfony/symfony/src/Symfony/Component/Config/Resource/DirectoryResource.php
at line 89