I get compiler erros in PHP 5.2 when using this as an object.
The offending lines are 609 and 940, which both contain this construct:
if ($this->size>0) $this->char = $this->doc;
This tries to get the first character of $this->doc, but PHP 5.2 sees it as trying to access it as an array.
It's easily fixed by this:
if ($this->size>0) $this->char = substr($this->doc, 0, 1);
Or you could probably use chr(ord($this->doc)) as well.
Either way solves the compile error without changing functionality.