If you have followed our recommendations in this book, then you have developed every line of your PHP code while having PHP errors, warnings, and notices verbosely printed. As a result, you knew immediately if at any time your code had so much as a hiccup. If you have somehow gotten to this point of the book without enabling PHP notices and errors, then do us all a favor and do not submit your plugin for public use. That may sound harsh, but under no circumstances should untested code be distributed to the public.
Hands down, this is the single worst problem that infests the third-party plugins in the WordPress repository. During the course of writing this book, we tested hundreds of plugins and it was shocking how many of them had errors that caused PHP notices to print. The majority of these notices came down to a simple pattern that looked something like this:
$x = $my_array['x']
That statement will work only if x
is defined in the array. It will throw...