Downgrading PHP 7.4 incompatible fread/fwrite checks

This commit is contained in:
Philipp Holzer 2021-05-25 20:21:51 +02:00
parent 91b474ea6d
commit 681f55315b
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD

View file

@ -162,7 +162,7 @@ class HTTPInputData
$lastLine = null; $lastLine = null;
while (($chunk = fgets($stream, 8096)) !== false && strpos($chunk, $boundary) !== 0) { while (($chunk = fgets($stream, 8096)) !== false && strpos($chunk, $boundary) !== 0) {
if ($lastLine !== null) { if ($lastLine !== null) {
if (fwrite($fileHandle, $lastLine) === false) { if (!fwrite($fileHandle, $lastLine)) {
$error = UPLOAD_ERR_CANT_WRITE; $error = UPLOAD_ERR_CANT_WRITE;
break; break;
} }
@ -171,7 +171,7 @@ class HTTPInputData
} }
if ($lastLine !== null && $error !== UPLOAD_ERR_CANT_WRITE) { if ($lastLine !== null && $error !== UPLOAD_ERR_CANT_WRITE) {
if (fwrite($fileHandle, rtrim($lastLine, "\r\n")) === false) { if (!fwrite($fileHandle, rtrim($lastLine, "\r\n"))) {
$error = UPLOAD_ERR_CANT_WRITE; $error = UPLOAD_ERR_CANT_WRITE;
} }
} }