- 状态
- 已解决
- 报告针对
- WPML Multilingual CMS 3.1.9.3
- 解决于
- 3.1.9.4
问题概述
Catchable fatal error: Object of class stdClass could not be converted to string in /home/lahjatup/public_html/markkinointiopisto.fi/wp-content/plugins/sitepress-multilingual-cms/inc/wpml-config/wpml-config.class.php on line 252
或者
Warning: dirname() expects parameter 1 to be string, object given in /home1/treasure/public_html/dev/wp-content/plugins/sitepress-multilingual-cms/inc/wpml-config/wpml-config.class.php on line 252
上述 PHP 错误将出现在您的管理后台页面中,例如您的插件、主题或 翻译管理 > 多语言内容设置 页面。
临时解决方法
- 通过 FTP 登录
- 找到 sitepress-multilingual-cms/
inc/wpml-config/wpml-config. class.php 文件 - 找到您看到的 PHP 错误中提到的行(252)。例如:
$type = ( dirname( $file ) == get_template_directory() || dirname( $file ) == get_stylesheet_directory() ) ? 'theme' : 'plugin'; $admin_text_context = basename( dirname( $file ) );
- 删除这两行代码
- 在同一文件中找到以下代码(大约在第 210 行):
}else{ $config = icl_xml2array( file_get_contents( $file ) ); } - 将此区块的代码修改为:
}else{ $config = icl_xml2array( file_get_contents( $file ) ); $type = ( dirname( $file ) == get_template_directory() || dirname( $file ) == get_stylesheet_directory() ) ? 'theme' : 'plugin'; $admin_text_context = basename( dirname( $file ) ); } - 保存文件并上传到您的服务器