File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ public static function open(callable $callback) {
7878 private int $ offset = 0 ;
7979 private int $ length = 0 ;
8080 private bool $ needReconnect = false ;
81+ private int $ totalSize = 0 ;
8182
8283 private function reconnect (int $ start ): bool {
8384 $ this ->needReconnect = false ;
@@ -128,6 +129,9 @@ private function reconnect(int $start): bool {
128129
129130 $ this ->offset = $ begin ;
130131 $ this ->length = $ length ;
132+ if ($ start === 0 ) {
133+ $ this ->totalSize = $ length ;
134+ }
131135
132136 return true ;
133137 }
@@ -211,7 +215,9 @@ public function stream_tell() {
211215
212216 public function stream_stat () {
213217 if ($ this ->getCurrent ()) {
214- return fstat ($ this ->getCurrent ());
218+ $ stat = fstat ($ this ->getCurrent ());
219+ $ stat ['size ' ] = $ this ->totalSize ;
220+ return $ stat ;
215221 } else {
216222 return false ;
217223 }
You can’t perform that action at this time.
0 commit comments