Page 1 of 1
Is it a bug ?
Posted: Fri Nov 24, 2006 2:31 pm
by moshax
Hello, I'm a PHP developer, and I have a serious issue with one of my clients, he considers the following matter as a bug and as an error in the code that shouldn't be exists:
The matter is (when a user click upload –in an upload form- and doesn't select any file to upload no error message appears to him and of course no files were uploaded)
The client considers that as a bug, because it must be an error message appears to the user
what do you see ? because I want to be a good programmer and if it technically a bug I'll try to avoid such mistakes in the future
Posted: Fri Nov 24, 2006 3:20 pm
by aaronhall
Well, it's a bug if it behaves differently than he expects. If the $_FILES superglobal is empty, return an error message to the client.
Posted: Fri Nov 24, 2006 3:50 pm
by moshax
Thanks for reply aaronhall but I mean technically is it a bug or a lack of a feature
Posted: Fri Nov 24, 2006 4:04 pm
by volka
Depends on what the script does with the (non-existing) filedata. Might very well be a bug.
Posted: Fri Nov 24, 2006 4:25 pm
by Chris Corbyn
Unexpected behaviour = bug
IMO. Of course, we'd need to know more about the exact situation.
You should really validate form data at submission

Posted: Fri Nov 24, 2006 5:03 pm
by aaronhall
moshax wrote:Thanks for reply aaronhall but I mean technically is it a bug or a lack of a feature
Your question has more to do with semantics than programming conventions.. Like d11wtq said, a bug is an unexpected behavior. The definition depends on whose expectations you are adhering to. In your case, that would be your client's expectations. If it was outlined in your project specs that the form should return an error if no file was uploaded, then I guess you could consider that a bug. Right now, the form is behaving exactly as
you would expect it to.
by the way
Posted: Sat Nov 25, 2006 7:14 am
by Jaxolotl
In any case a "no error message" is not a
sine qua non condition to consider there is a bug.
Some people (newbies most of all) FORGETS to allow error messages when scripting.
Code: Select all
// Turn off all error reporting
error_reporting (0);
// Report simple running errors
error_reporting (E_ERROR | E_WARNING | E_PARSE);
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings)
error_reporting (E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// Report all PHP errors (use bitwise 63 in PHP 3)
error_reporting (E_ALL);
//The last one return ALL error messages and Notices, try this when scripting
I know is stupid what I said but sometimes the Basics are forgotten
Posted: Sat Nov 25, 2006 7:42 am
by moshax
Many thanks, all to your time and I'll remember you with the bug Definition
A software bug is an error, flaw, mistake, failure, or fault in a computer program that prevents it from behaving as intended (e.g., producing an incorrect result).
Posted: Sat Nov 25, 2006 9:45 am
by timvw
moshax wrote:
The matter is (when a user click upload –in an upload form- and doesn't select any file to upload no error message appears to him and of course no files were uploaded) The client considers that as a bug, because it must be an error message appears to the user
Dear user, you're a **** because you instructed your http user-agent to submit the form without providing it a file....
moshax wrote:
A software bug is an error, flaw, mistake, failure, or fault in a computer program that prevents it from behaving as intended (e.g., producing an incorrect result).
I wouldn't consider humans that don't behave as intended as bugs...
Anyway, i think that we can conclude that you've learned that your requirements gathering needs to improve in order to avoid such things... (And yes, more talking with the client means more time, wich means more costs, which a more expensive product.)