Is it a bug ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
moshax
Forum Newbie
Posts: 3
Joined: Fri Nov 24, 2006 2:25 pm

Is it a bug ?

Post 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
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
moshax
Forum Newbie
Posts: 3
Joined: Fri Nov 24, 2006 2:25 pm

Post by moshax »

Thanks for reply aaronhall but I mean technically is it a bug or a lack of a feature
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Depends on what the script does with the (non-existing) filedata. Might very well be a bug.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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 :)
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
User avatar
Jaxolotl
Forum Contributor
Posts: 137
Joined: Mon Nov 13, 2006 4:19 am
Location: Argentina and Italy

by the way

Post 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
moshax
Forum Newbie
Posts: 3
Joined: Fri Nov 24, 2006 2:25 pm

Post 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).
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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.)
Post Reply