title: GZIP decode file with php, have it working just trying to get rid of errors outputted by E_ALL
body: <p>I have this function for decoding gzipped files,</p>
  
  <pre><code>// GZIP DECODE
  function gzipDecode($d) {
      $f = ord(substr($d, 3, 1));
      $h = 10;
      $e = 0;
      if($f&amp;4) {
          $e = unpack('v', substr($d, 10, 2));
          $e = $e[1];
          $h += 2 + $e;
      }
      if($f&amp;8) {
          $h = @strpos($d, chr(0), $h) + 1;
      }
      if($f&amp;16) {
          $h = strpos($d, chr(0), $h) + 1;
      }
      if($f&amp;2) {
          $h += 2;
      }
      $u = @gzinflate(substr($d, $h));
      if($u == false) {
          $u = $d;
      }
      return $u;
  }
  </code></pre>
  
  <p>It works as expected but I turned on error reporting and I get these two errors</p>
  
  <p><strong>Warning: strpos(): Offset not contained in string</strong></p>
  
  <p>AND</p>
  
  <p><strong>Warning: gzinflate(): data error</strong></p>
  
  <p>These warnings refer to the bits of code above that have been error supressed, have any idea on how I can fix them?</p>
  
  <p>Thanks</p>