8000 bug #53785 [FrameworkBundle] Prevent silenced warning by checking if … · symfony/symfony@354cc2c · GitHub
[go: up one dir, main page]

Skip to content

Commit 354cc2c

Browse files
bug #53785 [FrameworkBundle] Prevent silenced warning by checking if /proc/mount exists (shyim)
This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] Prevent silenced warning by checking if /proc/mount exists | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT `cache:clear` sometimes throws a warning as it tries to access `/proc/mounts`. This does not exist on macOS. Therefore I skipped that check completely for non linux systems. Example output from the command line: <img width="918" alt="Screenshot 2024-02-04 at 18 34 30" src="https://github.com/symfony/symfony/assets/6224096/7edab2a9-e07c-436a-917d-4b4f8572f553"> Commits ------- 349b3e7 [FrameworkBundle] Prevent silenced warning by checking if /proc/mount exists
2 parents 2bfac0d + 349b3e7 commit 354cc2c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ public function __construct(CacheClearerInterface $cacheClearer, ?Filesystem $fi
4949
$this->filesystem = $filesystem ?? new Filesystem();
5050
}
5151

52-
/**
53-
* {@inheritdoc}
54-
*/
5552
protected function configure()
5653
{
5754
$this
@@ -71,9 +68,6 @@ protected function configure()
7168
;
7269
}
7370

74-
/**
75-
* {@inheritdoc}
76-
*/
7771
protected function execute(InputInterface $input, OutputInterface $output): int
7872
{
7973
$fs = $this->filesystem;
@@ -208,7 +202,7 @@ private function isNfs(string $dir): bool
208202

209203
if (null === $mounts) {
210204
$mounts = [];
211-
if ('/' === \DIRECTORY_SEPARATOR && $files = @file('/proc/mounts')) {
205+
if ('/' === \DIRECTORY_SEPARATOR && is_readable('/proc/mounts') && $files = @file('/proc/mounts')) {
212206
foreach ($files as $mount) {
213207
$mount = \array_slice(explode(' ', $mount), 1, -3);
214208
if (!\in_array(array_pop($mount), ['vboxsf', 'nfs'])) {

0 commit comments

Comments
 (0)
0