Skip to content

[テーマ管理] テーマ名に半角カッコがあるとページ管理の初期表示がシステムエラーになる #2465

Description

@masaton0216

概要

ページ管理画面の初期表示で、テーマ名に半角カッコ ( ) を含むテーマが存在すると、画面全体がシステムエラーになります。

ページ管理の初期表示は PageManage::index()PluginBase::getThemes()public/themes/ 配下の すべての themes.iniparse_ini_file() で読み込みます。PHP の INI 形式では ( ) { } | & ~ ! ^ " が予約文字で、値に使う場合はダブルクォートで囲む必要があります。テーマ名に半角カッコが裸で入っていると parse_ini_file() が構文エラーになります。

さらに Connect-CMS は独自エラーハンドラ PluginBase::ccErrorHandler() で警告を ErrorException として throw するため、壊れた themes.ini が 1 つあるだけでページ管理画面全体が落ちます

該当ログ

production.ERROR: syntax error, unexpected '(' in /srv/.../public/themes/Users/user_02/themes.ini on line 2
at app/Plugins/PluginBase.php:182
#1 app/Plugins/PluginBase.php(182): parse_ini_file()
#2 app/Plugins/Manage/PageManage/PageManage.php(117): getThemes()
#3 app/Plugins/Manage/PageManage/PageManage->index()

原因となった themes.ini(例)

[base]
theme_name = theme_user_02 (clear-steelblue)

2 行目の (clear-steelblue) の半角 ( が引用符なしのため構文エラーになる。

実行環境

  • Connect-CMS: v1.44.0 系
  • 対象: app/Plugins/PluginBase.php getThemes() / ccErrorHandler()

再現手順

  1. テーマ管理、もしくは SCP 等で public/themes/Users/xxx/themes.ini を作成する
  2. theme_name に半角カッコを含める(例: theme_name = theme_user_02 (clear-steelblue)
  3. 管理画面のページ管理を開く
  4. システムエラーになり、ページ管理画面が表示できない

暫定対処

該当 themes.ini の値をダブルクォートで囲む(または半角カッコをやめる)と解消する。

[base]
theme_name = "theme_user_02 (clear-steelblue)"

恒久対策の案

  1. 保存時のサニタイズ: テーマ管理画面で themes.ini を書き出す際、theme_name を必ずダブルクォートで囲む(根本対策)。
  2. 読み込み側の堅牢化: getThemes()parse_ini_file() を try/catch で囲み、壊れたテーマ 1 件で画面全体が落ちないようスキップする。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugバグ・不具合連絡

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions