Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stop suppressing warnings/erros with @?
#1
I believe the title says it all Smile

I would request that the devs stop using the suppressing operator as it causes more wrong than good.

The suppress operator is slower and shows a type o programming that should only be seen on new programmers. There are several places to look for why the use of @ is not recommended but I think the following reasons are enough to rethink the use of the operator:
  • PHP needs to dynamically change error reporting to 0 as soon as it finds the @ operator, and then to the way it's set in the ini file after the line is executed. This incurs in a performance penalty that is not needed.
  • When errors are suppressed I, as a programmer, will have a hard time debugging the code. The suppression applies to every error or warning and those are platform and server dependent, I can have a warning that never happens in one host and one that will happen if I move to another host. I will never know what happen.
  • If there are errors/warnings then they should be handled not suppressed, send the errors and warnings to a log file in production but don't hide them.

I've seen the use of the @ in cases as simple as accessing a $_GET variable, this should be handled with a simple isset, that is a language construct and thus faster then the suppression or any function, and also makes the code correct.

I my understand the easiness in using @ on file access, though I still think it to be wrong, but why use @ instead of a simple isset?

I know this can be a personal choice but I think the change is simple and easy to make and that the project will gain from it, resulting in code that does not hide errors or warnings, easing debugging and the discovery of any hidden bug due to server settings differences.

Your thoughts on the subject?

Regards,

Sérgio Lopes
Rejoice! For very bad things are about to happen.
Reply
#2
No newly added code should have any @, neither should code that has recently been updated.

Most @-suppressing stems from the first versions of GetSimple. We completely agree with you, we just haven’t gone through all the files yet.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#3
OK, I'll try to either indicate any file that still uses the @ or provide a patch that removes those that are still around.

Thanks for the quick answer.

Regards,

Sérgio Lopes
Rejoice! For very bad things are about to happen.
Reply




Users browsing this thread: 1 Guest(s)