Hi all;

I am looking to submit an RFC in order to remove the error suppression
operator in PHP, namely the @ symbol.

I am happy to implement this, although it is merely a concept so far.

My reasons for looking to do this are:
- the error suppression operator leads to developers being lazy about
wrapping things in issets, try/catch blocks or not handling errors correctly
- this leads to painful debugging for developers working on projects with
high technical debt
- it's slow (though admittedly not that much slower)
- careless error suppression can be reduced by forcing developers to learn
about how to properly handle errors
- when the @ symbol is used to prepend database queries, when there is a
genuine error, it can cause the rest of the script to run successfully
causing data integrity issues. If developers were forced to handle errors
correctly this would be less of an issue.
- lastly, this operator can lead to scripts dying due to a fatal error
without any explanation of why, leading to painful debugging; all because a
developer was too lazy to wrap a variable in an isset.

Aside from doing this, there are a number of alternatives: re-engineering
the behaviour of the error suppression operator and potentially bringing
into the scope of a function (e.g. silence()); this said, I still feel this
would contain similar issues as it wouldn't address the underlying issues
of lazy error suppression.

Lastly, I recognise this will be a big change to PHP; but I feel it is
necessary to enhance the quality of PHP error handling. Let's not forget
that PHP managed to successfully deprecate the MySQL library.

Looking forward to hearing your thoughts.

Thanks

Reply via email to