Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Fixes EOF handling

Author Dave Jarvis <email>
Date 2026-02-21 17:21:55 GMT-0800
Commit 1074112b3217194be7e63c231d17882f33c659ff
Parent 86f65d7
Delta 5 lines added, 4 lines removed, 1-line increase
git/CompressionStream.php
<?php
+require_once __DIR__ . '/StreamReader.php';
class CompressionStream {
private Closure $pumper;
}
- public function stream( mixed $handle, int $chunkSize = 8192 ): Generator {
+ public function stream( StreamReader $handle, int $chunkSize = 8192 ): Generator {
$done = false;
- while( !$done && !feof( $handle ) ) {
- $chunk = fread( $handle, $chunkSize );
- $done = $chunk === false || $chunk === '';
+ while( !$done && !$handle->eof() ) {
+ $chunk = $handle->read( $chunkSize );
+ $done = $chunk === '';
if( !$done ) {