File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/Symfony/Component/HttpFoundation/File/MimeType Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public function __construct($cmd = 'file -b --mime %s 2>/dev/null')
43
43
*/
44
44
public static function isSupported ()
45
45
{
46
- return '\\' !== DIRECTORY_SEPARATOR && function_exists ('passthru ' ) && function_exists ('escapeshellarg ' );
46
+ return '\\' !== DIRECTORY_SEPARATOR && function_exists ('passthru ' ) && function_exists ('escapeshellarg ' ) && static :: hasFileBinary () ;
47
47
}
48
48
49
49
/**
@@ -82,4 +82,14 @@ public function guess($path)
82
82
83
83
return $ match [1 ];
84
84
}
85
+
86
+ /**
87
+ * @return bool
88
+ */
89
+ private static function hasFileBinary ()
90
+ {
91
+ static $ exists ;
92
+
93
+ return isset ($ exists ) ? $ exists : ($ exists = null !== shell_exec ('command -v file ' ));
94
+ }
85
95
}
You can’t perform that action at this time.
0 commit comments