Fatal error: Uncaught Error: Function name must be a string (Responsive Google Maps WP Plugin - Metabox.php on line 115)

Fatal error: Uncaught Error: Function name must be a string (Responsive Google Maps WP Plugin - Metabox.php on line 115)

各位开发人员和问题解决者,大家好,

我 运行 遇到了一个 PHP7 问题,我的代码似乎需要更新:

/home/wp-theme/public_html/wp-content/plugins/responsive-google-maps/classes/MarkAdCoreClasses/Metabox.php on line 115

我进行了一些搜索,但未能在 Stack Overflow 上的其他线程中找到这个特定问题。我对 PHP 有点熟悉,但不是处理核心 PHP 文件的专家。我更像是一名 front-end/full-stack 开发人员。

Error Shown on the sidebar: "Responsive Google Maps" WordPress Plugin

Fatal error: Uncaught Error: Function name must be a string in /home/wp-theme/public_html/wp-content/plugins/responsive-google-maps/classes/MarkAdCoreClasses/Metabox.php:115 Stack trace: #0 /home/wp-theme/public_html/wp-admin/includes/template.php(1048): ResponsiveGoogleMaps_MarkAdCoreClasses_Metabox->render_metabox_content(Object(WP_Post), Array) #1 /home/wp-theme/public_html/wp-admin/edit-form-advanced.php(696): do_meta_boxes(Object(WP_Screen), 'side', Object(WP_Post)) #2 /home/wp-theme/public_html/wp-admin/post.php(173): include('/home/wp-theme...') #3 {main} thrown in /home/wp-theme/public_html/wp-content/plugins/responsive-google-maps/classes/MarkAdCoreClasses/Metabox.php on line 115

Source code: Metabox.php on line 115

$field_output .= $this->form_fields->$field['type'](array($field, $settings['metabox_id'], $passed_values));

如果有人能帮助我,我将不胜感激。提前致谢。

第 115 行似乎在调用一个动态函数,其名称是从 form_fields 对象中数组类型的 $field 变量中检索的。

几年前 CodeCanyon 项目页面上似乎确实报告过同样的问题 here

我建议重新下载插件并将其上传到网站上的 /wp-content/plugins/ 文件夹,看看最新的更新是否解决了问题。

设法修复它,我是对的

变化

$field_output .= $this->form_fields->$field['type'](array($field, $settings['metabox_id'], $passed_values));

$field_output .= $this->form_fields->{$field['type']}(array($field, $settings['metabox_id'], $passed_values));