title: Image Uploads Not Working Correctly with PHP 7.2 +
body: <p>I'm creating a HTML / PHP form with a file upload field. I've been building it with PHP 7.1 and everything was working as expected, but when I tried running a newer version of PHP some image files don't seem to upload properly. Of the types I've tested HEIC and PNG don't seem to process correctly in PHP 7.2 or above. </p>
  
  <p>Code: </p>
  
  <pre class="lang-php prettyprint-override"><code>function get_mime_type($file) {
      $mtype = false;
      if (function_exists('finfo_open')) {
          $finfo = finfo_open(FILEINFO_MIME_TYPE);
          $mtype = finfo_file($finfo, $file);
          finfo_close($finfo);
      } elseif (function_exists('mime_content_type')) {
          $mtype = mime_content_type($file);
      } 
      return $mtype;
  }
  
      //Attachment Checks
      if (!empty($_FILES['attachment'])) { //If there are attachments
          $count = count($_FILES['attachment']['name']);
          if ($count &gt; 0) {
              for ($i = 0; $i &lt; $count; $i ++) {
  
                  //File Format Check
                  $imageFileType = strtolower(pathinfo($_FILES["attachment"]["name"][$i],PATHINFO_EXTENSION));
                  $imageMIME = get_mime_type($_FILES["attachment"]["tmp_name"][$i]);
                  if (!in_array($imageFileType, $validExtensions)){
                      $fileFormatError = 1;
                  }
                  if (!in_array($imageMIME, $validMIMETypes)){
                      $fileFormatError = 1;
                  }
                  echo $imageMIME . " ";
              }
          }
  
          //Checks
          if (array_sum($_FILES["attachment"]["size"]) &gt; ($totalFileSizeLimit * 1048576)){
              $fileSizeError = 1;
          }
      }
  echo '&lt;pre&gt;'; print_r($_FILES['attachment']); echo '&lt;/pre&gt;';
  </code></pre>
  
  <p>Output with PHP 7.1:</p>
  
  <pre><code>application/octet-stream image/png image/jpeg application/pdf
  Array
  (
      [name] =&gt; Array
          (
              [0] =&gt; IMG_1209.HEIC
              [1] =&gt; vlcsnap-2018-09-14-09h25m12s582.png
              [2] =&gt; IMG_0919.JPG
              [3] =&gt; Notifications Report.pdf
          )
  
      [type] =&gt; Array
          (
              [0] =&gt; application/octet-stream
              [1] =&gt; image/png
              [2] =&gt; image/jpeg
              [3] =&gt; application/pdf
          )
  
      [tmp_name] =&gt; Array
          (
              [0] =&gt; /tmp/phpELiNGi
              [1] =&gt; /tmp/phpUQzMvA
              [2] =&gt; /tmp/phpTsoccW
              [3] =&gt; /tmp/php4u2G9k
          )
  
      [error] =&gt; Array
          (
              [0] =&gt; 0
              [1] =&gt; 0
              [2] =&gt; 0
              [3] =&gt; 0
          )
  
      [size] =&gt; Array
          (
              [0] =&gt; 2896766
              [1] =&gt; 2681160
              [2] =&gt; 2066662
              [3] =&gt; 79876
          )
  
  )
  </code></pre>
  
  <p>Output with PHP 7.2 or above:</p>
  
  <pre><code>image/jpeg application/pdf
  Array
  (
      [name] =&gt; Array
          (
              [0] =&gt; IMG_1209.HEIC
              [1] =&gt; vlcsnap-2018-09-14-09h25m12s582.png
              [2] =&gt; IMG_0919.JPG
              [3] =&gt; Notifications Report.pdf
          )
  
      [type] =&gt; Array
          (
              [0] =&gt; 
              [1] =&gt; 
              [2] =&gt; image/jpeg
              [3] =&gt; application/pdf
          )
  
      [tmp_name] =&gt; Array
          (
              [0] =&gt; 
              [1] =&gt; 
              [2] =&gt; /tmp/phpHO95fL
              [3] =&gt; /tmp/phpeGaIre
          )
  
      [error] =&gt; Array
          (
              [0] =&gt; 1
              [1] =&gt; 1
              [2] =&gt; 0
              [3] =&gt; 0
          )
  
      [size] =&gt; Array
          (
              [0] =&gt; 0
              [1] =&gt; 0
              [2] =&gt; 2066662
              [3] =&gt; 79876
          )
  
  )
  </code></pre>