Skip to content

fix: メールフィールド名にMySQL予約語を登録するとエラーが発生する (#4332)#1

Closed
teratai3 wants to merge 1 commit into
5.1.xfrom
cursor/development-environment-setup-1f71
Closed

fix: メールフィールド名にMySQL予約語を登録するとエラーが発生する (#4332)#1
teratai3 wants to merge 1 commit into
5.1.xfrom
cursor/development-environment-setup-1f71

Conversation

@teratai3

@teratai3 teratai3 commented Mar 21, 2026

Copy link
Copy Markdown
Owner

概要

フォーク元 Issue: baserproject/basercms#4332

メールフィールドの管理画面でフィールド名にMySQLの予約語(例: select)を登録すると、メール送信時にSQL構文エラーが発生する問題を修正。

原因

MailFieldsTable::validationDefault() にMySQL予約語のバリデーションチェックが含まれていなかった。BcValidation::reserved() は既に実装済みで、bc-custom-contentCustomFieldsTable では適用済みだったが、MailFieldsTable には未適用だった。

変更内容

  • plugins/bc-mail/src/Model/Table/MailFieldsTable.php
    • validationDefault()BcValidation プロバイダー(bc)を登録
    • field_name フィールドに reserved バリデーションルールを追加
  • plugins/bc-mail/tests/TestCase/Model/Table/MailFieldsTableTest.php
    • 予約語バリデーションのユニットテストを追加(select, insert, update などの予約語、および正常なフィールド名をテスト)

テスト結果

  • MailFieldsTableTest: 30テスト全パス(incomplete 2件は既存)
  • BcMail テストスイート全体: 327テスト全パス

参考

CustomFieldsTable の同様の実装:
https://github.com/baserproject/basercms/blob/5.1.x/plugins/bc-custom-content/src/Model/Table/CustomFieldsTable.php#L73-L78

Open in Web Open in Cursor 

Co-authored-by: tera <teratai3@users.noreply.github.com>
@cursor cursor Bot changed the title Add AGENTS.md with Cursor Cloud development environment setup instructions fix: メールフィールド名にMySQL予約語を登録するとエラーが発生する (#4332) Mar 21, 2026
@teratai3 teratai3 closed this Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants