]> granicus.if.org Git - php/commitdiff
MFH: More accurate max_file_size / upload_max_filesize (fixes #45124)
authorArnaud Le Blanc <lbarnaud@php.net>
Sun, 7 Sep 2008 14:18:11 +0000 (14:18 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Sun, 7 Sep 2008 14:18:11 +0000 (14:18 +0000)
NEWS
main/rfc1867.c

diff --git a/NEWS b/NEWS
index 517c604ab2a3e21254e662f54ca80549f5a39812..0a00b97b8bb6c03edc5769cc91b90fc76b455e0c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -69,6 +69,8 @@ PHP                                                                        NEWS
   (Dmitry)
 - Fixed bug #45139 (ReflectionProperty returns incorrect declaring class).
   (Felipe)
+- Fixed bug #45124 ($_FILES['upload']['size'] sometimes return zero and 
+  sometimes the filesize). (Arnaud)
 - Fixed bug #45028 (CRC32 output endianness is different between crc32() 
   and hash()). (Tony)
 - Fixed bug #45004 (pg_insert() does not accept 4 digit timezone format).
index a878d55c6cf81b9dd5791a169ea5acd8e3acb0ac..715c8e967d3a1a943629ae09fa5efb871b710962 100644 (file)
@@ -1077,12 +1077,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
                                }
                                
                        
-                               if (PG(upload_max_filesize) > 0 && total_bytes > PG(upload_max_filesize)) {
+                               if (PG(upload_max_filesize) > 0 && (total_bytes+blen) > PG(upload_max_filesize)) {
 #if DEBUG_FILE_UPLOAD
                                        sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of %ld bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
 #endif
                                        cancel_upload = UPLOAD_ERROR_A;
-                               } else if (max_file_size && (total_bytes > max_file_size)) {
+                               } else if (max_file_size && ((total_bytes+blen) > max_file_size)) {
 #if DEBUG_FILE_UPLOAD
                                        sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of %ld bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename);
 #endif