- ステータス
- 解決済み
- 報告対象
- 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 ) ); } - ファイルを保存し、サーバーにアップロードします。