Jump to content

This a necessary fix?


SirChick

Recommended Posts

<b>Notice</b>:  Undefined index:  HouseType in <b>C:\xampp\htdocs\homeloginvariables.php</b> on line <b>37</b><br />

 

Was wondering if this "needs" to be corrected? Its worked fine without me actually doing anything about it... is a problem going to arise  in future if i dont do anything about it ?

Link to comment
https://forums.phpfreaks.com/topic/67518-this-a-necessary-fix/
Share on other sites

NOTICE messages will warn you about possible bugs in your code. For example, use of unassigned values is warned. It is extremely useful to find typos and to save time for debugging. NOTICE messages will warn you about bad style. For example, $arr[item] is better to be written as $arr['item'] since PHP tries to treat "item" as constant. If it is not a constant, PHP assumes it is a string index for the array.
Link to comment
https://forums.phpfreaks.com/topic/67518-this-a-necessary-fix/#findComment-339018
Share on other sites

Well, there are different schools of thought about this. Some believe, if it works, no need to fix it. After all, Notice errors are Notices, they aren't fatal or serious. By just turning off error reporting, problem solved.

 

However, another school of thought may suggest that this is bad practice, and a foundation for unpredictable problems later down the road (this is my belief as well)--ideally, you should prepare for errors at every possible turn and have a fallback in case it occurs, even for notice level errors.

 

While it is solely up to you which school you prefer, I'd recommend the stricter route.

Link to comment
https://forums.phpfreaks.com/topic/67518-this-a-necessary-fix/#findComment-339035
Share on other sites

It would have different "schools" of thought if we were talking about different approaches to a problem. Actually we are talking about script errors, bugs which shouldnt be ignored, even if they dont affect the general script. As u recommended about the stricter rule, it should be a practice for all programers.

 

Actually, those who think "if it works, no need to fix it" are lazy, not very pationate about scripting or just newbies who just want to get the script done.

Link to comment
https://forums.phpfreaks.com/topic/67518-this-a-necessary-fix/#findComment-339040
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.