File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/Symfony/Component/HttpFoundation/File/MimeType Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,21 @@ 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
+ static $ supported = null ;
47
+
48
+ if (null !== $ supported ) {
49
+ return $ supported ;
50
+ }
51
+
52
+ if ('\\' === DIRECTORY_SEPARATOR || !function_exists ('passthru ' ) || !function_exists ('escapeshellarg ' )) {
53
+ return $ supported = false ;
54
+ }
55
+
56
+ ob_start ();
57
+ passthru ('command -v file ' , $ exitStatus );
58
+ $ binPath = trim (ob_get_clean ());
59
+
60
+ return $ supported = 0 === $ exitStatus && '' !== $ binPath ;
47
61
}
48
62
49
63
/**
You can’t perform that action at this time.
0 commit comments