Skip to content

Commit ccbdc1a

Browse files
bug #53138 [FrameworkBundle] Prevent silenced warning by checking if /proc/mount exists (GromNaN)
This PR was merged into the 7.1 branch. Discussion ---------- [FrameworkBundle] Prevent silenced warning by checking if `/proc/mount` exists | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT When running `bin/console cache:clear -vvv` on Mac OS, I get the following warning: ``` 12:40:51 DEBUG [php] Warning: file(/proc/mounts): Failed to open stream: No such file or directory [ "exception" => Symfony\Component\ErrorHandler\Exception\SilencedErrorContext { +count: 1 -severity: E_WARNING trace: { ./vendor/symfony/framework-bundle/Command/CacheClearCommand.php:203 { …} ./vendor/symfony/framework-bundle/Command/CacheClearCommand.php:156 { …} } } ] ``` This warning can be avoided by checking whether the file exists. Maybe the `@` can be removed also. I'm not sure about the branch to target as this is not really a bug. Commits ------- 8f9a51e [FrameworkBundle] Prevent silenced warning by checking if file exists
2 parents 3418e7b + 8f9a51e commit ccbdc1a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private function isNfs(string $dir): bool
200200

201201
if (null === $mounts) {
202202
$mounts = [];
203-
if ('/' === \DIRECTORY_SEPARATOR && $files = @file('/proc/mounts')) {
203+
if ('/' === \DIRECTORY_SEPARATOR && is_readable('/proc/mounts') && $files = @file('/proc/mounts')) {
204204
foreach ($files as $mount) {
205205
$mount = \array_slice(explode(' ', $mount), 1, -3);
206206
if (!\in_array(array_pop($mount), ['vboxsf', 'nfs'])) {

0 commit comments

Comments
 (0)