#21964 [Opn]: Uploads of a file with size 0 bytes succeed.

From: Date: Sat, 01 Feb 2003 11:06:08 +0000
Subject: #21964 [Opn]: Uploads of a file with size 0 bytes succeed.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-31831@lists.php.net to get a copy of this message
ID: 21964 Updated by: nicos@php.net Reported By: johnson@nicusa.com Status: Open -Bug Type: Documentation problem +Bug Type: Filesystem function related -Operating System: Solaris 8 +Operating System: ANY -PHP Version: 4.2.2 +PHP Version: ANY New Comment: Actually it looks more than a documentation problem: For now there is not any define(name) for the new error code. Plus it looks it's under a #ifdef that can't happen because of : #undef DEBUG_FILE_UPLOAD in line 39 of main/rfc1867.c. There is the code: #ifdef DEBUG_FILE_UPLOAD if(strlen(filename) > 0 && total_bytes == 0) { sapi_module.sapi_error(E_WARNING, "Uploaded file size 0 - file [%s=%s] not saved", param, filename); cancel_upload = 5; } #endif You can note that usually #ifdef DEBUG_FILE_UPLOAD is used only to hide the sapi_module.sapi_error() function not the whole code. eg: if(strlen(filename) == 0) { #ifdef DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "No file uploaded"); #endif cancel_upload = UPLOAD_ERROR_D; } There is also an another point, why a file with 0 byte has to be cancelled? Has it been discussed? According to melvyn: why would php stop me to upload a file of 0 bytes? Take a 'web-ftp' for like a sitebuilder kinda app it would just upload these and create a 0 byte file, which is what I expect it to do for instance: config.php in phpBB2 is 0 bytes outof the box. it needs that to be, for install to work. So now there are some questions, does the code 5 ever happen? If yes is it expected that it stops the upload and why do not give it a real name so we can finally document it. Previous Comments: ------------------------------------------------------------------------ [2003-01-30 11:43:59] iliaa@php.net I believe this was fixed in 4.2.3 and later. ------------------------------------------------------------------------ [2003-01-30 10:47:31] johnson@nicusa.com I have seen in various places, postings that an uploaded file with size of 0 bytes should now fail. In version 4.2.2 on Solaris 8 it succeeds. Please make clear in the documentation exactly when/in which version of PHP this was changed to throw an error code 5. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21964&edit=1

« previous php.bugs (#31831) next »