We recently spun up a new server with newer php. Tested the new server, converted dns records to now point to the new server, etc. I was about to take it out of maintenance and noticed drupal had an update. We were running 7.99. I figured not much risk, never had a problem updating drupal. Still, upgraded in test and it seemed fine, upgraded prod and took it out of maintenance. Now if you log out and log back in you get "The website encountered an error" page. Reloading the page will get you to the after login screen.
The log showed this error message:
TypeError: array_values(): Argument #1 ($array) must be of type array, null given in array_values() (line 60 of /usr/share/nginx/oursite/sites/all/modules/rules/modules/entity.eval.inc)
I did the same upgrade to 7.100 on the old server and it doesn't have the problem. It's running php 7.2.24. Of course, with spinning up a new server there are lots of other things that are updated.
I hack the file and fixed it with this:
return array('entity_fetched' => is_array($return)? array_values($return): array());
original code
return array('entity_fetched' => array_values($return);
I find it hard to believe there is bug in the code. I'm guessing we're missing some entity.
Any thoughts on how to fix this properly?