升级到PHP 7后,如何解决仪表板上的致命RevSlider错误?[关闭]


36

我可以访问网站的公共端。但是仪表板变成空白。

日志显示指向RevSlider插件的错误:

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

这是完整的痕迹:

#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

1
AFAICT的RevSlider是特定于Wordpress的插件。我确实尝试了revslider.stackexchange.com,但对我来说是404s
查普曼·阿特威尔

3
这在这里可能不合适,但是对我来说最有用,因为此错误使在PHP升级后完全无法访问管理员,并且解决该问题不是调试发生的事情,而只是从接受的答案中应用此修补程序。
Antti Haapala

Answers:


67

我可以通过将服务器上的RevSlider插件修复为以下方式来修复错误: 记录在这里

revslider/includes/framework/base-admin.class.php,我将以下行(我的版本的l。21)从:

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

至:

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

8
您可以使用[]代替array()
fuxia

在2018年为我工作!
eyal_katz

2
做得好!刚刚在我的服务器上升级到php 7.2,这派上了用场!
Spencer Bigum '18

嗨,谢谢你的回答!就我而言,我使用的是churchHope wordpress模板,并且在/churchope/lib/revslider/inc_php/framework/base_admin.class.php:72上遇到错误-通过更改私有静态$ arrMetaBoxes =“”来解决此问题。私有静态$ arrMetaBoxes = array();
Paul Preibisch

我欠你啤酒。+1并作解释,在php7中,您对类型有更严格的限制,因此在将空字符串视为数组时,不能在其后附加一个空字符串。正如@fuxia所提到的,[]在这里也可以很好地工作,并且更加Python化。
Ligemer
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.