More on PHP Error Handling
OK so I’ve been talking about PHP errors for a while now but one more post. I found some code for customizing error handing in PHP , I installed it and got overwhelmed with emails reporting errors on my sites. I had to spend most of yesterday fixing issues on my sites. Most were minor issues of course – the worse is using uninitialized variables such as $ret = $Data[‘notset’]; where the value in $Data hasn’t been set. In reality the code works and its being pedantic but it still needs fixing with:
$ret = isset( $Data[‘notset’] ) ? $Data[‘notset’] : “” ;
But some reports were real errors, such as unitialised variables that needed a value, referencing arrays using -> instead of [], and other nasties. Some I can do nothing about – WordPress plugins seem to be especially bad for using uninitialised variables. For now I’m using the code on custom applications and avoiding WordPress.