Dealing with warnings that are now errors
In this section, we look at upgraded PHP 8 error handling pertaining to objects, arrays, and strings. We also examine situations where, in the past, PHP issued a
Warning but where PHP 8 now throws an
Error. It is critical that you become aware of any of the potential error situations addressed in this section. The reason is simple: if you fail to address the situations described in this section, when your server is upgraded to PHP 8 your code will break.
Developers are often pressed for time. It could be that there's a massive queue of new features or other changes that must be made. In other cases, resources have been pulled away to other projects, meaning fewer developers are available to perform maintenance.
Warnings are often ignored because the application continues to run, so many developers simply turn off the error display and hope for the best.
Over the years, mountains upon mountains of badly written code have accumulated...