Tổng quan về sự cố
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
Hoặc
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
Các lỗi PHP trên sẽ xuất hiện trong các trang quản trị của bạn như các trang plugin, giao diện hoặc Quản lý dịch thuậtThiết lập nội dung đa ngôn ngữ.
Giải pháp tạm thời
Sự cố này đã được khắc phục. Việc cập nhật lên phiên bản mới nhất giải quyết vấn đề này trên trang web của bạn, vì vậy bạn chỉ cần giải pháp tạm thời này nếu chưa thể cập nhật.
- Đăng nhập qua FTP
- Tìm tệp sitepress-multilingual-cms/
inc/wpml-config/wpml-config. class.php - Tìm dòng được đề cập trong lỗi PHP mà bạn thấy (252). Ví dụ:
$type = ( dirname( $file ) == get_template_directory() || dirname( $file ) == get_stylesheet_directory() ) ? 'theme' : 'plugin'; $admin_text_context = basename( dirname( $file ) );
- Xóa cả hai dòng mã
- Trong cùng tệp đó, hãy tìm mã sau (khoảng dòng 210):
}else{ $config = icl_xml2array( file_get_contents( $file ) ); } - Sửa đổi khối mã này thành:
}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 ) ); } - Lưu tệp và tải lên máy chủ của bạn