protected function purge() { if ($this->fd) { if ($this->check_utf8 && !self::isValidUTF8($this->buffer)) { XLSXWriter::log("Error, invalid UTF8 encoding detected."); $this->check_utf8 = false; } fwrite($this->fd, $this->buffer); $this->buffer = ''; } }