fix loop early return, and workaround bug

This commit is contained in:
divinity76 2023-04-10 13:40:15 +02:00 committed by GitHub
parent f918b954b8
commit 3e1713e3eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -969,7 +969,12 @@ if (!empty($_FILES) && !FM_READONLY) {
if ($out) {
$in = @fopen($tmp_name, "rb");
if ($in) {
stream_copy_to_stream($in, $out);
if (PHP_VERSION_ID < 80009) {
// workaround https://bugs.php.net/bug.php?id=81145
while (!in_array($buff = fread($in, 4096), array("", false), true)) { fwrite($out, $buff); }
} else {
stream_copy_to_stream($in, $out);
}
$response = array (
'status' => 'success',
'info' => "file upload successful"