The length of strings is given by strlen, not count.
It's strange that this worked before. Although for big files it gave a String size overflow fatal error.
$leave = false;
while ( !$leave && !$this->mSource->atEnd() &&
- count($this->mBuffer) < $count ) {
+ strlen($this->mBuffer) < $count ) {
$read = $this->mSource->readChunk();
- if ( !count($read) ) {
+ if ( !strlen($read) ) {
$leave = true;
}
$this->mBuffer .= $read;
}
- if ( count($this->mBuffer) ) {
+ if ( strlen($this->mBuffer) ) {
$return = substr( $this->mBuffer, 0, $count );
$this->mBuffer = substr( $this->mBuffer, $count );
}