How can I fix fatal RevSlider error in dashboard after upgrading to PHP 7?

The question:

I can access the public side of the site. But the dashboard comes up blank.

The log shows an error pointing to the RevSlider plugin:

PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /var/www/html/wp-content/plugins/revslider/includes/framework/base-admin.class.php:141

Here’s the full trace:

#0 /var/www/html/wp-content/plugins/revslider/admin/revslider-admin.class.php(1143): RevSliderBaseAdmin::addMetaBox('Revolution Slid...', '', Array, NULL)
#1 /var/www/html/wp-content/plugins/revslider/admin/revslider-admin.class.php(145): RevSliderAdmin->addSliderMetaBox()
#2 /var/www/html/wp-content/plugins/revslider/admin/revslider-admin.class.php(87): RevSliderAdmin->init()
#3 /var/www/html/wp-content/plugins/revslider/revslider.php(327): RevSliderAdmin->__construct('/var/www/html/w...')
#4 /var/www/html/wp-settings.php(304): include_once('/var/www/html/w...')
#5 /var/www/html/wp-config.php(81): require_once('/var/www/html/w...')
#6 /var/www/html/wp-load.php(37): require_once('/var/www/html/w...')
#7 /var/www/html/wp-admin/admin-ajax.php(22): require_once('/var/www/html/w...')
#8 {main}
  thrown in /var/www/html/wp-content/plugins/revslider/includes/framework/base-admin.class.php on line 141, referer: https://192.168.16.18/wp-admin/plugins.php

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

I was able to fix the error by hotfixing the RevSlider plugin on my server as documented here.

In revslider/includes/framework/base-admin.class.php, I changed the following line (l. 21 of my version) from:

private static $arrMetaBoxes = '';         //option boxes that will be added to post

to:

private static $arrMetaBoxes = array();    //option boxes that will be added to post


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment