/**
  * Reads the file, detects the compression MIME type, closes the file
  * and returns the MIME type
  *
  * @param resource $file the file handle
  *
  * @return string the MIME type for compression, or 'none'
  */
 public static function getCompressionMimeType($file)
 {
     //Can't use PMA_StringMB here, so force use of PMA_StringNative.
     include_once 'libraries/StringNative.class.php';
     $pmaString = new PMA_StringNative();
     $test = fread($file, 4);
     $len = $pmaString->strlen($test);
     fclose($file);
     if ($len >= 2 && $test[0] == $pmaString->chr(31) && $test[1] == $pmaString->chr(139)) {
         return 'application/gzip';
     }
     if ($len >= 3 && $pmaString->substr($test, 0, 3) == 'BZh') {
         return 'application/bzip2';
     }
     if ($len >= 4 && $test == "PK") {
         return 'application/zip';
     }
     return 'none';
 }
 /**
  * Tests for chr
  *
  * @param string $ascii Ascii code
  *
  * @return void
  * @test
  * @dataProvider providerChr
  */
 public function testChr($ascii)
 {
     $native = $this->_native->chr($ascii);
     $multibytes = $this->_mb->chr($ascii);
     $this->assertTrue($native === $multibytes, 'native chr: ' . var_export($native, true) . ' - mb chr: ' . var_export($multibytes, true));
 }