Revision | ac35a3db3bda572427aa0491e1e7416c41feba37 (tree) |
---|---|
Time | 2021-12-14 23:37:09 |
Author | umorigu <umorigu@gmai...> |
Commiter | umorigu |
BugTrack/2514 PHP8: Avoid error on fread($fp, 0)
@@ -462,7 +462,12 @@ class tarlib | ||
462 | 462 | // ファイルデータの取得 |
463 | 463 | $fpr = @fopen($name , 'rb'); |
464 | 464 | flock($fpr, LOCK_SH); |
465 | - $data = fread($fpr, $size); | |
465 | + if ($size === 0) { | |
466 | + // Avoid error on fread($fp, 0); | |
467 | + $data = ''; | |
468 | + } else { | |
469 | + $data = fread($fpr, $size); | |
470 | + } | |
466 | 471 | flock($fpr, LOCK_UN); |
467 | 472 | fclose( $fpr ); |
468 | 473 |