public function read($length) { $content = parent::read($length); if ($content && !$this->reachedEof) { $this->cache .= $content; } if ($this->eof()) { $this->reachedEof = true; } return $content; }