X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/8dadaf0af0d3b92a2282a1c5bcb1305a97e135d8..41f33f9c1dac5381412bcab57c971fd08d1d8613:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index 850386b..cfb2703 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1205,10 +1205,13 @@ function jirafeau_encrypt_file($fp_src, $fp_dst) /* Crypt file. */ $r = fopen($fp_src, 'r'); $w = fopen($fp_dst, 'c'); - while (!feof($r)) { - $enc = mcrypt_generic($m, fread($r, 1024)); - if (fwrite($w, $enc) === false) { - return ''; + while (!feof($r)) { + $to_enc = fread($r, 1024); + if (strlen($to_enc) > 0) { + $enc = mcrypt_generic($m, $to_enc); + if (fwrite($w, $enc) === false) { + return ''; + } } } fclose($r);