File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,7 +84,17 @@ protected function fread($bytes) {
8484 if (!getid3_lib::intValueSupported ($ pos )) {
8585 throw new getid3_exception ('cannot fread( ' .$ bytes .' from ' .$ this ->ftell ().') because beyond PHP filesystem limit ' , 10 );
8686 }
87- return fread ($ this ->getid3 ->fp , $ bytes );
87+
88+ // System fread function may return less data than requested in case the file is not a regular local file.
89+ // See http://php.net/manual/en/function.fread.php. Call it repeatedly in a loop if that is the case.
90+ $ contents = '' ;
91+ do {
92+ $ part = fread ($ this ->getid3 ->fp , $ bytes );
93+ $ partLength = strlen ($ part );
94+ $ bytes -= $ partLength ;
95+ $ contents .= $ part ;
96+ } while ($ bytes > 0 && $ partLength > 0 );
97+ return $ contents ;
8898 }
8999
90100 protected function fseek ($ bytes , $ whence =SEEK_SET ) {
You can’t perform that action at this time.
0 commit comments