better PHP programmers use “error_reporting(E_ALL);”
…at least that’s what I’ve been learning this week.
By turning that on at the start of your PHP code, you can see all the previously hidden warnings/notices that your code was still able to run with, but probably should be looked at.
Having no formal school or book training in PHP it’s been learn-as-you-go but this definitely seems to be a good step to learn. I found a few potential problems in virtually all my plugins with all errors reported.
Once you spot the problems, the two biggest helpers are going to be “isset()” and the handy if/then shorthand, ie. (variable==1 ? ‘yes’ : ‘no’ )
For example if ($_GET[‘blah’]) is a very bad method. Should be if (isset($_GET[‘blah’]))
Well I’m off to update the bigger plugins on the svn with the fixes!
ps. surprisingly the bbpress and wordpress cores have a handful of warnings when the full error reporting is turned on… could be cleaned up fairly easily…