Register Login

Uncaught Error:[]Operator Not Supported For Strings In' While Updating Slider Revolution Plugin

15 Oct 2020 2:47 pm || 0

This error comes when I updated my PHP version from PHP 5.6 to 7.4

Error Code:

Plugin could not be activated because it triggered a fatal error.

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/mysite/htdocs/wp-content/plugins/revslider/includes/operations.class.php on line 2339

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/mysite/htdocs/wp-content/plugins/revslider/includes/operations.class.php on line 2343

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/mysite/htdocs/wp-content/plugins/revslider/includes/output.class.php on line 3165

Fatal error: Uncaught Error: [] operator not supported for strings in /home/mysite/htdocs/wp-content/plugins/revslider/includes/framework/base-admin.class.php:71 Stack trace: #0 /home/mysite/htdocs/wp-content/plugins/revslider/admin/revslider-admin.class.php(572): RevSliderBaseAdmin::addMetaBox() #1 /home/mysite/htdocs/wp-content/plugins/revslider/admin/revslider-admin.class.php(73): RevSliderAdmin->addSliderMetaBox() #2 /home/mysite/htdocs/wp-content/plugins/revslider/admin/revslider-admin.class.php(44): RevSliderAdmin->init() #3 /home/mysite/htdocs/wp-content/plugins/revslider/revslider.php(171): RevSliderAdmin->__construct() #4 /home/mysite/htdocs/wp-admin/includes/plugin.php(2297): include('/opt/bitnami/ap...') #5 /home/mysite/htdocs/wp-admin/plugins.php(191): plugin_sandbox_scrape() #6 {main} thrown in /home/mysite/htdocs/wp-content/plugins/revslider/includes/framework/base-admin.class.php on line 71 
Older versions of WordPress plugin Revolution Slider by ThemePunch has this same deprecated PHP code, and throws an error:

To fix this error

Open file plugins/revslider/includes/framework/base-admin.class.php in you favourite editor

Go to line no 71

self::$arrMetaBoxes[] = $box;

self::$arrMetaBoxes[] = $box; 

Change it to

self::$arrMetaBoxes = array();
self::$arrMetaBoxes[] = $box;

self::$arrMetaBoxes = array(); 

The Array declaration with [] is not supported after PHP 7 +

Old Code:

$myarray[]; // Not work PHP 7.1 and +

Correct Code:

$myarray = array();