q2a / question2answer

Question2Answer is a free and open source platform for Q&A sites, running on PHP/MySQL.
http://www.question2answer.org/
GNU General Public License v3.0
1.63k stars 628 forks source link

Fix many issues regarding $errors variable and @ character #894

Closed pupi1985 closed 3 years ago

pupi1985 commented 3 years ago

I've removed many usages of the @ sign and initialized the @errors variable in all pages I noticed it was used.

I have not removed all @ signs, but this should get the code one step closer to that.

This PR should also fix #888.

svivian commented 3 years ago

Thanks for this. We ought to move to PHP 7 minimum soon, so we can write $errors['key'] ?? null instead of all the isset() calls. I've done that in other projects and it makes things a lot neater!

pupi1985 commented 3 years ago

I know, I'm looking forward for that to happen :) The PHP 8 release can be used as an excuse for this dependency update.

The good thing of having the wordy isset()s in the code (compared to the @ sign) is that IDE's should be able to detect the "code smell" and hint the fix.