Sfoglia il codice sorgente

[HttpFoundation][Windows] Disabled FileBinaryMimeTypeGuesser for Windows OS

Pascal Borreli 14 anni fa
parent
commit
dbb18662d7

+ 9 - 0
src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php

@@ -21,6 +21,15 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
  */
 class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
 {
+    /**
+     * Returns whether this guesser is supported on the current OS
+     *
+     * @return Boolean
+     */
+    static public function isSupported()
+    {
+        return !strstr(PHP_OS, 'WIN');
+    }
     /**
      * Guesses the mime type of the file with the given path
      *

+ 3 - 1
src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php

@@ -63,7 +63,9 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
      */
     private function __construct()
     {
-        $this->register(new FileBinaryMimeTypeGuesser());
+        if (FileBinaryMimeTypeGuesser::isSupported()) {
+            $this->register(new FileBinaryMimeTypeGuesser());
+        }
 
         if (ContentTypeMimeTypeGuesser::isSupported()) {
             $this->register(new ContentTypeMimeTypeGuesser());