Fix Drupal 7 errors/warnings about count(), cache_get(), and each().
Tags:
Upgrading PHP to 7.2 might break your Drupal 7.
Here are some error/warning examples and how to fix them.
PHP Fatal error: Uncaught Error: Call to undefined function cache_get() in /usr/share/drupal7/includes/module.inc: 750
- replace
ini_set('session.save_handler', 'user');
withsession_set_save_handler(new SessionHandler());
in settings.php - https://www.drupal.org/project/drupal/issues/3026449
- replace
Warning: count(): Parameter must be an array or an object that implements Countable in theme_table() (line 1997 of /usr/share/drupal7/includes/theme.inc).
- replace
count()
with!empty()
- https://www.drupal.org/project/drupal/issues/2938567
- replace
Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in menu_set_active_trail() (line 2404 of /usr/share/drupal7/includes/menu.inc).
- deprecate
exch()
- https://www.drupal.org/project/drupal/issues/2925449
- deprecate
- Email this page
- 3474 reads
Add new comment