protected function decompress() { if (is_resource($this->outputStream)) { $compressed = stream_get_contents($this->outputStream, -1, 10); $compressed = String::getBinarySubstring($compressed, 0, -8); if ($compressed != '') { $uncompressed = gzinflate($compressed); rewind($this->outputStream); $len = fwrite($this->outputStream, $uncompressed); ftruncate($this->outputStream, $len); } } else { $compressed = String::getBinarySubstring($this->result, 10, -8); if ($compressed != '') { $this->result = gzinflate($compressed); } } }