PHP 7.2 problems with count() function
Cesar Campana
Software Lead, Cleared Software Engineer, Space and Airborne Systems. TS/SCI - Cloud, MMIS from NSU, Masters in engineering management from UCF!, Security+ certified.
I had an app written in PHP 7.0 and after migrating to PHP 7.2, I start seeing error 500 because I couldn't access the web interface. However, in my page, I was able to detect and error in the count function in one of my php files.
Long story short, you will waste hours and hours of your time, trying to find a solution to why PHP 7.2 is behaving this way. Also there are articles that said that this is a common error, and to fix it you will have to install the latest upgrade. Up to the time I am writing this article, even having the latest update, I was able to still see the dirty error.
If you are having several arrays and you were using count() in PHP 7.0 to add all the arrays, don't do it anymore. You can delete the count() function and add the arrays directly.
Done, don't waste your time trying to write your own count functions, or trying to install a patch that honestly doesn't exist until today.
I am disappointing with PHP 7.2 for not making this backward compatible and not giving a clear solution to the problem.