feat: Add experimental SQLite3 database support#1318
feat: Add experimental SQLite3 database support#1318nanasess merged 33 commits intoEC-CUBE:masterfrom
Conversation
- create_table_sqlite3.sql: SQLiteスキーマファイルを作成 - MySQL版からデータ型を変換(INT→INTEGER, numeric→REAL, etc) - PRIMARY KEY/UNIQUEの長さ指定を削除 - SQLite3ネイティブ構文で106テーブル+インデックスを定義 - eccube_install.sh: SQLite3インストールケースを追加 - create_table_sqlite3.sqlを直接使用するように簡略化 - シーケンステーブルも自動作成 - bootstrap_sqlite3.php: PHPUnit用SQLite3ブートストラップ - ファイルベースDB(/tmp/eccube_test_phpunit.db)を使用 - スキーマ自動作成(106テーブル) - 初期データ自動投入(1451レコード) 状況: - eccube_install.sh sqlite3 での DB作成は成功 - テーブル作成とデータ投入は正常動作 - MDB2経由でのアクセスに課題あり(要調査) 課題: - MDB2のSQLite3ドライバーでlistTableFields()等が 正常に動作しない可能性 - SC_Plugin_Util初期化でエラー発生(要デバッグ) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- SC_DB_DBFactory_SQLITE3: 新しいDBファクトリークラス - SERIAL PRIMARY KEY → INTEGER PRIMARY KEY AUTOINCREMENT 変換 - OFFSET単独使用時に LIMIT -1 を自動付与(SQLite3要件) - sfChangeXXX メソッドでSQL方言変換をサポート - sqlite_version() でバージョン取得 - SC_DB_DBFactory: getInstance()にsqlite3ケースを追加 - SC_ClassAutoloader: TEST_FUNCTION定義時にプラグイン読み込みをスキップ - SQLite3などプラグインテーブル未初期化時のエラー回避 テスト結果: - SC_Query_Test: 20テスト中19テスト成功 (95% success rate) ✅ - 環境変数でSQLite3切り替え可能: DB_TYPE=sqlite3 DB_NAME=/tmp/test.db phpunit tests/class/SC_Query_Test.php 残課題: - testListSequences: SQLite3のシーケンス管理が異なるため失敗 (nextID()はMDB2が自動管理) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SC_Query.php: - INSERT構文を適切に切り替え: FROM句がある場合は INSERT...SELECT、 ない場合は INSERT...VALUES を使用(SQLite3互換性のため) - メモリセーフなエラーログ実装: 巨大配列/文字列を要約表示し、 メモリ枯渇を防止 eccube_install.sh: - SQLite3シーケンステーブル初期化を修正: AUTOINCREMENT属性を使用し、9999を挿入後すぐ削除することで 次のINSERTから10000で開始 tests/bootstrap_sqlite3.php: - MDB2接続テストとSC_Query動作確認を追加 - デバッグ情報を充実させ、トラブルシューティングを容易に Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix string concatenation style in SC_Query.php - Remove tests/bootstrap_sqlite3.php (不要なファイル) - Clean up experimental test files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add docker-compose.sqlite3.yml for SQLite3 configuration - Update unit-tests.yml matrix to include sqlite3 - SQLite3 uses file-based database (/var/www/app/data/eccube.db) - No external database service required for SQLite3 This enables faster test execution with SQLite3 alongside existing MySQL and PostgreSQL tests. Test matrix now includes: - PHP 7.4-8.5 (except dependabot: only 8.4) - MySQL, PostgreSQL, SQLite3 (except dependabot: only MySQL) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
プラグインテーブル(dtb_plugin, dtb_plugin_hookpoint)は eccube_install.shで全てのDB(MySQL, PostgreSQL, SQLite3)で 初期化されるため、TEST_FUNCTION時のプラグイン読み込み スキップは不要。 元の動作に戻すことで、テスト環境でもプラグイン機能が 正しく動作するようになる。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
docker compose up後にconfig.phpが生成されずハングする問題を修正。 - dockerbuild/wait-for-sqlite3.sh を新規作成 - config.phpが存在しない場合、eccube_install.sh sqlite3を実行 - MySQLやPostgreSQLと同じパターンで初期化 - docker-compose.sqlite3.yml に entrypoint を追加 - entrypoint: /wait-for-sqlite3.sh これにより、SQLite3環境でも自動的にDBとconfig.phpが初期化され、 GitHub Actionsのunit-testsワークフローが正常に動作する。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Dockerfileにコメントを追加してキャッシュレイヤーを無効化。 これにより、COPY dockerbuild/wait-for-*.sh が再実行され、 新規追加されたwait-for-sqlite3.shが確実にイメージに含まれる。 Exit code 127 (command not found) の原因はキャッシュされた 古いDockerイメージにwait-for-sqlite3.shが含まれていなかったため。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
eccube_install.sh がsqlite3コマンドを使用しているが、 Dockerイメージにインストールされていなかったため、 コンテナが起動時にexit code 127で失敗していた。 変更内容: - Dockerfile: sqlite3パッケージをapt-get installに追加 - unit-tests.yml: 失敗時にコンテナログを出力する ステップを追加(デバッグ用) これにより、eccube_install.sh sqlite3 が正常に実行され、 SQLite3データベースとconfig.phpが作成される。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
トランザクション中のdtb_pluginテーブルへのSELECTが 「Native code: 1」エラーで失敗する問題を修正。 問題の原因: - Common_TestCaseのsetUp()でbegin()を呼ぶ - その後SC_Helper_Pluginがdtb_pluginにアクセス - SQLite3のデフォルトジャーナルモードでは、書き込み トランザクション中に他の接続からの読み取りがブロック 解決策: - WAL (Write-Ahead Logging) モードを有効化 - 読み取りと書き込みの並行実行が可能になり、テスト中の プラグインテーブルアクセスが正常に動作 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add concatColumn(), getDownloadableDaysWhereSql(), getOrderYesterdaySql(),
getOrderMonthSql(), getReviewYesterdaySql(), getSendHistoryWhereStartdateSql()
to SC_DB_DBFactory_SQLITE3
- Add CURRENT_TIMESTAMP/Now() to datetime('now','localtime') conversion
to fix UTC vs localtime mismatch
- Add EXTRACT(field FROM column) to strftime() conversion for SQLite3
- Change date separator from '/' to '-' in SC_SelectSql::selectTermRange()
for SQLite3 date() function compatibility
- Change DEFAULT CURRENT_TIMESTAMP to DEFAULT (datetime('now','localtime'))
in create_table_sqlite3.sql for consistent timezone handling
- Fix shipping_date format in SC_Helper_Purchase::registerShipping()
to include time component for SQLite3 TEXT column compatibility
- Fix potential SQL injection in addLimitOffset() by adding (int) cast
- Fix command injection risk in wait-for-sqlite3.sh by using getenv()
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1318 +/- ##
==========================================
+ Coverage 54.39% 54.72% +0.32%
==========================================
Files 83 84 +1
Lines 10658 10815 +157
==========================================
+ Hits 5797 5918 +121
- Misses 4861 4897 +36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
EC-CUBE 2 固有のレビュー指針を追加。セキュリティ、DB互換性、 後方互換性、コード品質、テストの優先順位でレビューを実施する。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
このPRの目的は、既存の MySQL / PostgreSQL 対応に加えて SQLite3 を実験的にサポートし、テスト実行環境を軽量化しつつ、主要ヘルパークラスおよびオートローダ周りのテストを拡充することだと理解しました。
Changes:
- SQLite3 用の DB ファクトリ (
SC_DB_DBFactory_SQLITE3)・テーブルDDL・インストールスクリプト・Docker 構成を追加し、DB 抽象化層および CI マトリクスにsqlite3を組み込み。 SC_Queryの INSERT 構文生成・エラーログ出力、SC_SelectSqlの日付フォーマット、SC_Helper_Purchase::registerShipping()の日付保存形式などを SQLite3 互換になるよう調整。SC_Helper_*各種・SC_CartSession・SC_ClassAutoloader・CSV/Bloc/Mailtemplate/Delivery/Holiday/Payment などのテストを大量追加し、振る舞いの回帰テストを強化。
Reviewed changes
Copilot reviewed 62 out of 62 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/class/helper/SC_Helper_Session/SC_Helper_Session_tokenTest.php | セッショントークン生成・検証・破棄処理の挙動を網羅的にテスト |
| tests/class/helper/SC_Helper_Session/SC_Helper_Session_sfSessTest.php | MDB2 バックエンドのセッションハンドラ (dtb_session) のCRUD/Gc動作をテスト |
| tests/class/helper/SC_Helper_Session/SC_Helper_Session_TestBase.php | セッション用 Common_TestCase ベースと dtb_session 初期化ヘルパーを追加 |
| tests/class/helper/SC_Helper_Payment/SC_Helper_Payment_staticMethodsTest.php | useModule()/getIDValueList() の振る舞い・ID/値のマッピングをテスト |
| tests/class/helper/SC_Helper_Payment/SC_Helper_Payment_saveTest.php | 支払方法の新規/更新保存と rank・creator_id・create_date の保持を検証 |
| tests/class/helper/SC_Helper_Payment/SC_Helper_Payment_getTest.php | get()/getList() の削除フラグ・rank 順ソートなどの挙動をテスト |
| tests/class/helper/SC_Helper_Payment/SC_Helper_Payment_getByPriceTest.php | 金額条件付き支払方法フィルタリングロジックのテストを追加 |
| tests/class/helper/SC_Helper_Payment/SC_Helper_Payment_deleteAndRankTest.php | 支払方法の論理削除と rankUp/rankDown による順位入れ替えの検証 |
| tests/class/helper/SC_Helper_Payment/SC_Helper_Payment_TestBase.php | dtb_payment 初期化とシーケンス利用のためのテストベースクラスを追加 |
| tests/class/helper/SC_Helper_Mailtemplate/SC_Helper_Mailtemplate_saveTest.php | メールテンプレート保存時の ID 採番・更新時の creator_id/create_date 保持をテスト |
| tests/class/helper/SC_Helper_Mailtemplate/SC_Helper_Mailtemplate_getTest.php | get() による削除フラグと存在しないIDの扱いを検証 |
| tests/class/helper/SC_Helper_Mailtemplate/SC_Helper_Mailtemplate_getListTest.php | getList() の削除除外・has_deleted・カラム内容をテスト |
| tests/class/helper/SC_Helper_Mailtemplate/SC_Helper_Mailtemplate_TestBase.php | dtb_mailtemplate を扱うテスト用ベースクラスを追加 |
| tests/class/helper/SC_Helper_Holiday/SC_Helper_Holiday_saveTest.php | 休日マスタの新規/更新保存と rank 自動設定・creator_id 保持をテスト |
| tests/class/helper/SC_Helper_Holiday/SC_Helper_Holiday_isDateExistTest.php | isDateExist() の重複判定・削除済/自分自身の除外ロジックを検証 |
| tests/class/helper/SC_Helper_Holiday/SC_Helper_Holiday_getTest.php | get() の削除フラグ・存在しないID時の null 返却をテスト |
| tests/class/helper/SC_Helper_Holiday/SC_Helper_Holiday_getListTest.php | getList() の rank 降順ソート・削除除外・必要カラムの有無を検証 |
| tests/class/helper/SC_Helper_Holiday/SC_Helper_Holiday_deleteAndRankTest.php | 休日の「物理削除」および rankUp/rankDown の順位調整動作をテスト |
| tests/class/helper/SC_Helper_Holiday/SC_Helper_Holiday_TestBase.php | dtb_holiday を対象としたテストベースクラスを追加 |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_saveTest.php | 配送方法保存時の dtb_deliv / delivtime / delivfee / payment_options 連動更新を網羅テスト |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_rankTest.php | 配送方法 rankUp/rankDown の順位入れ替えロジックを検証 |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_getTest.php | get() の配送詳細(時間・料金・支払ID・削除扱い)の取得をテスト |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_getPaymentsTest.php | getPayments() の rank 順序と配送ID別のフィルタリングをテスト |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_getListTest.php | getList() の商品種別別・削除フラグ・rank 降順取得を検証 |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_getDelivTimeTest.php | getDelivTime() の time_id 昇順ソートと存在しないID時の動作をテスト |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_getDelivFeeTest.php | getDelivFee() の単一/複数都道府県・削除済配送・未定義時の料金計算を検証 |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_getDelivFeeListTest.php | getDelivFeeList() の pref 昇順ソート・配送ID別結果をテスト |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_deleteTest.php | delete() の論理削除と rank の詰め処理・有効件数の変化を検証 |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_checkExistTest.php | checkExist() の新規/更新時の重複名判定・削除済の無視などをテスト |
| tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_TestBase.php | dtb_deliv 系テーブルの初期化ヘルパーをまとめたテストベースを追加 |
| tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_sfIsUpdateCSVFrameTest.php | sfIsUpdateCSVFrame() のキー/通常フィールド有効性判定ロジックをテスト |
| tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_sfIsImportCSVFrameTest.php | sfIsImportCSVFrame() の必須フィールド有効性と error_check_types の扱いを検証 |
| tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_sfGetCsvOutputTest.php | sfGetCsvOutput() のランク順・ステータス条件・必要カラムの取得をテスト |
| tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_sfGetCSVRecordCountTest.php | CSV 行数カウントとファイルポインタ復元動作をテスト |
| tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_sfArrayToCsvTest.php | sfArrayToCsv() のエスケープ・配列結合・区切り/囲み文字オプションを検証 |
| tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_initTest.php | init() が arrSubnavi/arrSubnaviName を想定通り初期化することをテスト |
| tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_fopenForOutputCsvTest.php | fopen_for_output_csv() の出力先・CSV書き込み・CRLF 改行変換を検証 |
| tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_TestBase.php | dtb_csv 用のテストベースクラス・一時CSVファイルユーティリティを追加 |
| tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_saveTest.php | ブロック保存の DB 反映と tpl ファイル作成・ID 自動採番の挙動をテスト |
| tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_getWhereTest.php | getWhere() の条件付き・デバイス別・該当なし時の結果を検証 |
| tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_getListTest.php | getList() のデバイスフィルタ・カラム内容・件数をテスト |
| tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_getDeviceTypeIDTest.php | getDeviceTypeID() のデフォルト/引数指定時の戻り値を検証 |
| tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_getBlocTest.php | getBloc() の bloc_html 読み込み・デバイス不一致・存在しないID時挙動をテスト |
| tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_deleteTest.php | delete() の deletable_flg 判定・ファイル/ポジション削除をテスト |
| tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_TestBase.php | dtb_bloc/position 初期化とブロックファイル生成・掃除のベースクラスを追加 |
| tests/class/SC_ClassAutoloaderTest.php | Ex クラス群と SC_ClassAutoloader のパス生成ロジック整合性・オートロード/エイリアス動作のテストを追加(PHP 8 関数使用箇所に互換性問題あり) |
| tests/class/SC_CartSession/SC_CartSession_quantityTest.php | カート数量の取得/設定/増減・合計数量の挙動をテスト |
| tests/class/SC_CartSession/SC_CartSession_getNextCartIDTest.php | getNextCartID() の商品種別ごとの ID 採番ロジックを検証 |
| tests/class/SC_CartSession/SC_CartSession_getAllProductClassIDTest.php | getAllProductClassID() の商品種別ごとの product_class_id 一覧取得をテスト |
| tests/class/SC_CartSession/SC_CartSession_delProductTest.php | delProduct()/delAllProducts() の削除範囲と商品種別別の影響を検証 |
| html/install/sql/create_table_sqlite3.sql | SQLite3 用に全テーブルDDLとインデックスを追加(日時は TEXT + datetime('now','localtime')) |
| eccube_install.sh | sqlite3 DBTYPE を追加し、SQLite3 用 DDL 適用・シーケンステーブル生成・オプションSQL実行を実装 |
| dockerbuild/wait-for-sqlite3.sh | SQLite3 用エントリポイントを追加し、インストールと WAL モード有効化処理を実装(PHP SQLite3 拡張未導入による実行時エラー懸念あり) |
| docker-compose.sqlite3.yml | SQLite3 バックエンドで EC-CUBE を起動する Docker Compose 変種を追加 |
| data/class/helper/SC_Helper_Purchase.php | registerShipping() で shipping_date を Y-m-d から Y-m-d H:i:s に変更し、SQLite TEXT 日時と整合を取る |
| data/class/db/dbfactory/SC_DB_DBFactory_SQLITE3.php | SQLite3 用 DBFactory を新規実装(SQL 方言変換・LIMIT/OFFSET・ダウンロード可否など)し、DB_TYPE=sqlite3 をサポート(PHP 7.4 非互換の関数使用と集計系メソッド未実装の問題あり) |
| data/class/db/SC_DB_DBFactory.php | getInstance() に sqlite3 分岐を追加して SQLite3 ファクトリを返すように変更 |
| data/class/SC_SelectSql.php | selectTermRange() の日付フォーマットを YYYY/MM/DD から YYYY-MM-DD に変更し、SQLite3 の date() 互換を確保 |
| data/class/SC_Query.php | insert() に FROM 有無で INSERT..SELECT/VALUES を切り替えるロジックを追加し、SQLite3 互換性と traceError() の巨大配列ログ時メモリ使用を抑制する処理を追加 |
| Dockerfile | ビルド時に sqlite3 CLI を追加し、wait-for-*.sh のコピーと実行権限付与で SQLite3 エントリポイントを使えるように変更(PHP SQLite 拡張は未追加) |
| .github/workflows/unit-tests.yml | CI マトリクスに sqlite3 を追加し、失敗時のコンテナログ収集を強化 |
| .github/copilot-instructions.md | レビュー観点・優先順位など Copilot 向けプロジェクトガイドラインを追加 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… factory LC_Page_Admin_Total の売上集計画面が SQLite3 でも動作するよう、 期間別集計と年代別集計の SQL 生成メソッドを追加。 - getOrderTotalDaysWhereSql: strftime() で日/月/年/時間別の集計、 曜日は CASE 式で略称に変換(SQLite3 に曜日フォーマット非対応のため) - getOrderTotalAgeColSql: strftime() で年齢算出、整数除算で10年単位に切り捨て Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- SC_DB_DBFactory_SQLITE3Test: SQL方言変換、concatColumn、
売上集計SQL、年代別集計SQL、addLimitOffset 等 27テスト追加
- SC_DB_DBFactoryTest: getInstance('sqlite3') のインスタンス検証を追加
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… strings Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
E2E テストの run-on-linux ジョブに PHP 8.4 × sqlite3 の 組み合わせを include で追加。フィクスチャの顧客メール更新 ステップも sqlite3 CLI 用を追加。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
いつかやろうと思ってたやつ、やっていただいて素晴しすぎる😭 |
dtb_products_class を使い、REAL 型カラム(stock, price01, price02, point_rate)が listTableFields から返され、extractOnlyColsOf で 除外されないことを検証する。 E2E の SQLite3 テストで fixture 生成時に price02 が INSERT から 欠落して NOT NULL 制約違反が発生する問題の原因切り分け用。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PHP バージョン固有の問題か切り分けるため、sqlite3 を db matrix に追加。 全 PHP バージョン (7.4-8.5) で SQLite3 E2E テストを実行する。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fixture 生成前に dtb_products_class の listTableFields 結果をダンプし、 REAL 型カラムが返されているか確認する。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…parsing MDB2's _getTableColumns regex does not recognize REAL type, causing listTableFields to silently drop numeric columns (stock, price01, price02, point_rate, etc). This broke eccube:fixtures:generate in CI. DOUBLE produces the same SQLite REAL affinity and is already in MDB2's regex. Also adds data provider tests covering multiple tables and removes the temporary debug script from E2E workflow. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SQLite3 does not support ALTER TABLE DROP COLUMN in versions below 3.35.0. The test cleanup fails because it tries to drop the added column after the assertion. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The entrypoint creates the SQLite database as root, but Apache runs as www-data. Without write permissions, all INSERT/UPDATE operations fail with SQLITE_READONLY (native code 8). Also make the parent directory writable for WAL journal files. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Existing tests only verify SQL string generation. These new tests actually execute the aggregation queries against the database to expose runtime SQLite3 compatibility issues. Tests cover: period/age/product/member/job totals (matching LC_Page_Admin_Total queries) and SQLite3 date() function behavior with slash-delimited dates (returns NULL, unlike MySQL/PostgreSQL). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@nobuhiko nanasess/MDB2#6 をマージしました。他に MDB2 の修正が無ければ、 2.5.2 をリリースしようと思いますがいかがですか? |
|
@nanasess 思ったより動かないし、Dockerで環境構築が楽になったから逆にめんどくさいーw |
SQLite3's date() function only accepts ISO 8601 format (YYYY-MM-DD). Slash-delimited dates (YYYY/MM/DD) cause date() to return NULL, breaking WHERE clauses in admin total and product review pages. Changes: - LC_Page_Admin_Total: date separators '/' → '-' in lfSetStartEndDate and lfGetWhereMember - LC_Page_Admin_Products_Review: date format Y/m/d → Y-m-d - SC_Utils::sfTermMonth: output format %d/%d/%d → %d-%02d-%02d - Update preg_split patterns to handle both '/' and '-' separators - Update sfTermMonth test expectations Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@nobuhiko 承知しました!当初は MDB2 に SQLite3 のサポートが無く、 バックエンドを pdo に変更して、その上で SQLite3 対応しようとしてました。 |
…bility SQLite3 uses string comparison for dates, so non-padded dates like "2026-1-27" fail to match against stored values "2026-01-27". Apply sprintf zero-padding in lfSetStartEndDate, sfGetTimestamp, sfGetTimestampistime, and selectTermRange. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@nanasess MDB2 の SQLite3 、シーケンスはちゃんと実装されていたので細かなSQLの違いだけ調整でいけました |
|
@nobuhiko すばらしい!ありがとうございます! |
|
@coderabbitai レビューお願いします。特に PostgreSQL/MySQL を使用した場合の共通部分の下位互換性について重点的にレビューしてください |
|
以下の点を特に注視してレビューを行います:
レビューを開始いたします。 ✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughSQLite3 を新たに公式サポートとして追加する変更一式。SQLite 専用 DB ファクトリと方言変換、インストールSQL、コンテナ起動スクリプト/docker-compose、CI マトリクス拡張、日付フォーマットの標準化、多数のテスト追加・修正を含む。 Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as DevClient
participant Container as Container/Entrypoint
participant Wait as /wait-for-sqlite3.sh
participant DB as SQLite3
participant App as PHP/Apache App
Dev->>Container: docker-compose.sqlite3 起動
Container->>Wait: entrypoint 実行
Wait->>DB: DB ファイル存在確認
alt config.php 不在(初回)
Wait->>DB: インストール処理(create tables / insert data)
end
Wait->>DB: PRAGMA journal_mode=WAL
Wait->>Container: 権限調整(chmod)して完了
Container->>App: docker-php-entrypoint 実行
App->>DB: アプリのクエリ(方言変換経由)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
|
@nobuhiko コンフリクト解消と、 README.md にも記載をお願いします🙇♂️ |
There was a problem hiding this comment.
Actionable comments posted: 10
🤖 Fix all issues with AI agents
In `@data/class/db/dbfactory/SC_DB_DBFactory_SQLITE3.php`:
- Around line 139-152: Replace the PHP 8-only str_contains usage in
sfChangeArrayToString with a PHP 7.4 compatible check using strpos;
specifically, change the condition that currently uses
str_contains(strtoupper($sql), 'ARRAY_TO_STRING') to use strpos on the
uppercased string and compare !== false so the function still detects
'ARRAY_TO_STRING' while remaining PHP 7.4 compatible.
In `@html/install/sql/create_table_sqlite3.sql`:
- Line 95: dtb_tax_rule の create_date 定義に DEFAULT
が抜けているため、テーブル定義を他のテーブルと一貫させるために、CREATE TABLE dtb_tax_rule の create_date 列に
DEFAULT (datetime('now','localtime'))
を追加して、明示的に値を渡さないINSERTでもエラーにならないように修正してください(参照: テーブル名 dtb_tax_rule と列名
create_date)。
In `@tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_deleteTest.php`:
- Around line 33-53: The test leaves a stray file "non_deletable_bloc.tpl"
because SC_Helper_Bloc_TestBase::tearDown() only cleans files matching
test_bloc_*.tpl; update the testDeletedeletableFlgが0の場合は削除できない() test to either
create the file with the test prefix (e.g. use
createBlocFile('test_bloc_non_deletable.tpl') and update the created bloc record
filename accordingly) or explicitly remove the file after the assertions (call
unlink on the template path for 'non_deletable_bloc.tpl'); adjust references to
the filename used by createBlocData and createBlocFile (and the final
assertFileExists check) so they are consistent with the chosen option.
In `@tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_TestBase.php`:
- Around line 43-44: file_put_contents($file_path, $content)
の戻り値をチェックして書き込み失敗を検出するか、書き込み前にディレクトリ存在確認を行ってください(例: is_dir(dirname($file_path))
を使う)、またはテスト環境で許容する旨をコメントして例外的扱いを明示してください;対象は SC_Helper_Bloc_TestBase.php 内の
file_put_contents 呼び出し(変数 $file_path,
$content)で、失敗時は明示的にエラーを返すかログ出力/例外を投げる実装に修正してください。
In `@tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_saveTest.php`:
- Around line 104-105: Remove the unused variable assignment to $existing in the
test — the call creating the fixture via createDelivData(['deliv_id' => 1,
'service_name' => '既存配送']) should either be deleted or executed without
assigning to $existing; update the test in SC_Helper_Delivery_saveTest.php by
removing the "$existing =" prefix so the fixture is created but no unused
variable remains (refer to the createDelivData invocation).
- Around line 72-77: The test fetches payments with $this->objQuery->select('*',
'dtb_payment_options', 'deliv_id = ?', [$deliv_id]) without a defined order,
making the assertions on $payments[0..2]['payment_id'] flaky; update the select
call to include a deterministic ordering (e.g., ORDER BY rank or another stable
column) so the expected payment_id order is stable before the asserts in
SC_Helper_Delivery_saveTest.php.
- Around line 49-55: The test is unstable because $this->objQuery->select('*',
'dtb_delivtime', 'deliv_id = ?', [$deliv_id]) returns rows in unspecified order;
update the test to enforce order before asserting by either adding an ORDER BY
to the select call (e.g. order by deliv_time) or sorting the $times array by
'deliv_time' prior to the assertions so $times[0]['deliv_time'] and
$times[1]['deliv_time'] are deterministic.
In
`@tests/class/helper/SC_Helper_Mailtemplate/SC_Helper_Mailtemplate_saveTest.php`:
- Around line 68-88: In testSave更新時にcreatorIdとcreateDateは変更されない, avoid comparing
raw DB datetime strings; instead normalize both values before asserting: parse
result['create_date'] and the expected '2020-01-01 00:00:00' into DateTime
objects (or use strtotime to get timestamps) and compare either timestamps or
format('Y-m-d H:i:s') so the assertion is DB-backend agnostic; update the
assertion that checks create_date accordingly while keeping the creator_id
assertion as-is.
In `@tests/class/helper/SC_Helper_Session/SC_Helper_Session_sfSessTest.php`:
- Around line 93-118: The test is inserting sessions using the literal
'CURRENT_TIMESTAMP', which SQLite treats as a string, causing update_date to be
wrong and GC to delete the row; update the test case testSfSessGc古いセッションを削除 to
pass an explicit datetime string (e.g. date('Y-m-d H:i:s')) for
create_date/update_date for both old and new sessions instead of
'CURRENT_TIMESTAMP', and also modify
SC_Helper_Session_TestBase::createSessionData to generate and use explicit
datetime strings for any create_date/update_date or timestamp defaults so
inserts are SQLite-compatible.
In `@tests/class/SC_ClassAutoloaderTest.php`:
- Line 27: Replace the PHP 8-only call to str_ends_with in the
SC_ClassAutoloaderTest autoloader check with a PHP 7.4-compatible string check:
locate the conditional that uses $file->getBasename('.php') and
str_ends_with(..., '_Ex') and change it to compare the basename's trailing
characters (e.g., use substr($basename, -3) === '_Ex' or an equivalent
strpos/strlen-based check) so the if condition in the autoloader test remains
compatible with PHP 7.4+.
🧹 Nitpick comments (25)
tests/class/SC_CartSession/SC_CartSession_getNextCartIDTest.php (2)
22-36: 重複したテストメソッドが存在します。
testGetNextCartID最初の商品追加後は次のIDが2とtestGetNextCartID商品追加後は次のIDを返すは、同じロジック(addProduct('1001', 1)を追加し、getNextCartID(1)が 2 を返すことを検証)をテストしています。どちらか一方を削除するか、異なるシナリオをテストするように修正することを検討してください。
38-47: アサーションをより具体的にすることを検討してください。
setUpBigProductClass()ではproduct_type_idはi % 3 + 1で計算されるため、3000-3004 の範囲でproduct_type_id = 1になるのは 3000 と 3003 の2件です。よってgetNextCartID(1)は 3 を返すはずです。
assertGreaterThanOrEqual(2, $nextId)よりもassertEquals(3, $nextId)の方がテストの意図が明確になります。♻️ より具体的なアサーションの提案
- $nextId = $this->objCartSession->getNextCartID(1); - $this->assertGreaterThanOrEqual(2, $nextId, '次のcart_noは2以上'); + $nextId = $this->objCartSession->getNextCartID(1); + // 3000-3004のうちproduct_type_id=1は3000と3003の2件 + $this->assertEquals(3, $nextId, '2商品追加後、次のcart_noは3');data/class/SC_Query.php (1)
1164-1170: メモリセーフなエラーログ出力の改善大きな配列/文字列をマスクする処理は適切です。ただし、条件の閾値について確認が必要です。
$valSize > 100: 100要素/バイトは比較的小さい閾値です。一部のユースケースで早期にマスクされる可能性があります- メモリ使用量100MBの閾値は合理的です
現在の実装で問題はありませんが、必要に応じて閾値を調整できるよう定数化を検討してください。
tests/class/SC_Query_Test.php (2)
417-435: カラム数のハードコードについてテストの目的(SQLite3でのDOUBLE型パース問題の検証)は明確で、数値型カラムの存在確認は適切です。
ただし、Line 434の
assertCount(19, $fields)はスキーマ変更時にテストが失敗する可能性があります。この値をハードコードする代わりに、最小限のカラム数チェック、またはカラム数の検証を省略することを検討してください。♻️ 脆弱性を軽減する代替案
- $this->assertCount(19, $fields, 'dtb_products_class のカラム数'); + // 最低限必要なカラム数を確認(数値型カラム6つ + その他の必須カラム) + $this->assertGreaterThanOrEqual(count($numericCols), count($fields), 'dtb_products_class のカラム数が不足');
437-471: extractOnlyColsOfのテストカバレッジSQLite3でのカラム欠落問題を検証するための適切なテストケースです。
nonexistent_colが除外されることの確認は、extractOnlyColsOfの基本動作を検証しています。Line 470の
assertCount(count($params) - 1, $result)は、$params内の全カラム(nonexistent_col以外)がdtb_products_classに存在することを前提としています。スキーマが変更された場合、このアサーションが失敗する可能性があります。♻️ より堅牢なアサーション
- $this->assertCount(count($params) - 1, $result); + // nonexistent_col が除外され、かつ数値型カラムが保持されていることを確認 + $this->assertLessThan(count($params), count($result), 'nonexistent_col が除外されていること');tests/class/helper/SC_Helper_Mailtemplate/SC_Helper_Mailtemplate_TestBase.php (1)
1-4: ライセンスヘッダーの配置が非標準です。
require_once文がライセンスヘッダーの前に配置されています。一般的にはライセンスヘッダーをファイルの先頭(<?phpの直後)に配置するのが慣例です。📝 提案: ライセンスヘッダーを先頭に移動
<?php - -$HOME = realpath(__DIR__).'/../../../..'; -require_once $HOME.'/tests/class/Common_TestCase.php'; /* * This file is part of EC-CUBE ... */ + +$HOME = realpath(__DIR__).'/../../../..'; +require_once $HOME.'/tests/class/Common_TestCase.php';tests/class/helper/SC_Helper_Mailtemplate/SC_Helper_Mailtemplate_saveTest.php (1)
10-44: 最初の2つのテストメソッドに重複があります。
testSave新規登録()とtestSave新規登録でTemplateIdを指定()は両方とも明示的なtemplate_idを指定して新規登録をテストしています。テストの意図が明確に異なるようには見えません。1つのテストに統合するか、または
testSave新規登録()でtemplate_idを指定せずにnextVal()による自動採番をテストすることを検討してください。tests/class/helper/SC_Helper_Session/SC_Helper_Session_TestBase.php (1)
11-12: 型アノテーションが実際のクラスと不一致
@var SC_Helper_Sessionと記載されていますが、実際にはSC_Helper_Session_Exをインスタンス化しています。型アノテーションを実際の使用クラスに合わせることを推奨します。📝 提案される修正
- /** `@var` SC_Helper_Session */ + /** `@var` SC_Helper_Session_Ex */ protected $objHelper;tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_TestBase.php (2)
1-4: ライセンスヘッダーの配置について
require_once文(3-4行目)がライセンスヘッダーコメント(5-25行目)の前に配置されています。一般的にはライセンスヘッダーをファイルの先頭に配置することが推奨されますが、動作上は問題ありません。
116-117: プロパティ宣言の位置について
$tmpFilesプロパティが、それを使用するcreateTempCsvFile()メソッド(111行目)の後に宣言されています。可読性向上のため、プロパティ宣言をクラスの先頭($objHelperの宣言の近く)に移動することを検討してください。♻️ 提案されるリファクタリング
class SC_Helper_CSV_TestBase extends Common_TestCase { /** `@var` SC_Helper_CSV */ protected $objHelper; + + /** `@var` resource[] 一時ファイルハンドル */ + private $tmpFiles = []; protected function setUp(): voidそして116-117行目の宣言を削除してください。
tests/class/helper/SC_Helper_CSV/SC_Helper_CSV_sfArrayToCsvTest.php (1)
5-11: 非推奨メソッドのテストについて
sfArrayToCsvはE_USER_WARNINGを発生させる非推奨メソッドです。テスト実行時に警告が出力される可能性があります。必要に応じて、PHPUnitの@expectWarningアノテーションまたはexpectWarning()メソッドを使用して警告をハンドリングすることを検討してください。♻️ 警告をハンドリングする例
PHP 7.4以上とPHPUnit 9+の場合:
public function testSfArrayToCsv基本的なCSV変換() { $this->expectWarning(); $this->expectWarningMessage('前方互換用メソッドが使用されました。'); $fields = ['id', 'name', 'price']; $result = $this->objHelper->sfArrayToCsv($fields); $this->assertEquals('id,name,price', $result); }または、
@演算子で警告を抑制する方法もあります。tests/class/helper/SC_Helper_Holiday/SC_Helper_Holiday_TestBase.php (1)
1-4: ライセンスヘッダーの配置について
require_once文がライセンスヘッダーの前に配置されています。他のテストベースファイル(例:SC_Helper_Mailtemplate_TestBase.php)と一貫性を保つため、ライセンスヘッダーをファイルの先頭に移動することを検討してください。tests/class/helper/SC_Helper_Holiday/SC_Helper_Holiday_deleteAndRankTest.php (1)
35-46: testGetList削除済み休日は含まれない のアサーション順序についてLines 44-45で、削除済みを除外した場合の結果順序をアサートしていますが、このテストでは
rankを指定していないため、デフォルトのrank=1が適用されます。getList()がrank降順でソートする場合、同一rankの順序はDB依存になる可能性があります。明示的にrankを設定するか、順序に依存しないアサーションに変更することを検討してください。
🔧 より堅牢なテストへの提案
public function testGetList削除済み休日は含まれない() { - $this->createHolidayData(['holiday_id' => 1, 'del_flg' => 0]); - $this->createHolidayData(['holiday_id' => 2, 'del_flg' => 1]); - $this->createHolidayData(['holiday_id' => 3, 'del_flg' => 0]); + $this->createHolidayData(['holiday_id' => 1, 'del_flg' => 0, 'rank' => 3]); + $this->createHolidayData(['holiday_id' => 2, 'del_flg' => 1, 'rank' => 2]); + $this->createHolidayData(['holiday_id' => 3, 'del_flg' => 0, 'rank' => 1]); $result = $this->objHelper->getList(); $this->assertCount(2, $result, '削除済み休日は除外される'); - $this->assertEquals(1, $result[0]['holiday_id']); - $this->assertEquals(3, $result[1]['holiday_id']); + $this->assertEquals(1, $result[0]['holiday_id'], 'rank=3の休日が最初'); + $this->assertEquals(3, $result[1]['holiday_id'], 'rank=1の休日が最後'); }tests/class/helper/SC_Helper_Holiday/SC_Helper_Holiday_getListTest.php (1)
35-46: testGetList削除済み休日は含まれない のアサーション順序についてLines 44-45で結果の順序をアサートしていますが、
rankを明示的に設定していないため、デフォルトのrank=1が全レコードに適用されます。同一rankの場合、返却順序はDB実装依存となり、SQLite3/MySQL/PostgreSQL間で結果が異なる可能性があります。🔧 提案: rankを明示的に設定して順序を確定
public function testGetList削除済み休日は含まれない() { - $this->createHolidayData(['holiday_id' => 1, 'del_flg' => 0]); - $this->createHolidayData(['holiday_id' => 2, 'del_flg' => 1]); - $this->createHolidayData(['holiday_id' => 3, 'del_flg' => 0]); + $this->createHolidayData(['holiday_id' => 1, 'del_flg' => 0, 'rank' => 2]); + $this->createHolidayData(['holiday_id' => 2, 'del_flg' => 1, 'rank' => 3]); + $this->createHolidayData(['holiday_id' => 3, 'del_flg' => 0, 'rank' => 1]); $result = $this->objHelper->getList(); $this->assertCount(2, $result, '削除済み休日は除外される'); - $this->assertEquals(1, $result[0]['holiday_id']); - $this->assertEquals(3, $result[1]['holiday_id']); + $this->assertEquals(1, $result[0]['holiday_id'], 'rank=2が最初'); + $this->assertEquals(3, $result[1]['holiday_id'], 'rank=1が最後'); }tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_TestBase.php (1)
58-63: file_put_contentsのエラーハンドリング検討
file_put_contents()が失敗した場合(ディレクトリが存在しない、パーミッション不足など)、エラーが発生せずにテストが予期しない状態になる可能性があります。テストの堅牢性のため、ディレクトリの存在確認やエラーチェックを追加することを検討してください。♻️ 提案する修正
protected function createBlocFile($filename, $content = '<div>テストブロック</div>') { $bloc_dir = SC_Helper_PageLayout_Ex::getTemplatePath(DEVICE_TYPE_PC).BLOC_DIR; + if (!is_dir($bloc_dir)) { + $this->fail('Bloc directory does not exist: '.$bloc_dir); + } $file_path = $bloc_dir.$filename; - file_put_contents($file_path, $content); + if (file_put_contents($file_path, $content) === false) { + $this->fail('Failed to write bloc file: '.$file_path); + } }tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_getWhereTest.php (1)
16-21: 結果の順序に関する前提の確認
$result[0]['bloc_id']と$result[1]['bloc_id']の順序をアサートしていますが、getWhere()メソッドがブロックIDの昇順を保証しているかどうか確認してください。ORDER BY句が明示されていない場合、データベースによって返却順序が異なる可能性があります。テストの安定性のため、順序に依存しないアサーションを検討してください:
♻️ 順序に依存しない検証の例
- $this->assertEquals(1, $result[0]['bloc_id']); - $this->assertEquals(3, $result[1]['bloc_id']); + $bloc_ids = array_column($result, 'bloc_id'); + $this->assertContains(1, $bloc_ids); + $this->assertContains(3, $bloc_ids);tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_getListTest.php (1)
28-33: 結果の順序の前提について
SC_Helper_Bloc_getWhereTestと同様に、結果の順序をハードコーディングしてアサートしています。getList()が明示的にORDER BYを指定していない場合、SQLite3と他のデータベース間で結果の順序が異なる可能性があります。tests/class/helper/SC_Helper_Bloc/SC_Helper_Bloc_saveTest.php (2)
68-74: 実装のバグに関するドキュメンテーション
getBloc()の戻り値に関するバグ($arrExists[0]ではなく$arrExistsを返す)についてのコメントは有用なドキュメントです。この既知のバグに対するissueの作成を検討してください。テストコード内でバグを許容するより、バグ修正後にテストを更新する方が望ましいです。この実装のバグを追跡するためのissueを作成しましょうか?
95-100: スキップされたテストについてロールバックのテストをスキップしている理由は理解できますが、PHPUnitのモック機能を使用してファイルシステム操作をモック化することで、テスト可能になる場合があります。将来の改善として検討してください。
tests/class/helper/SC_Helper_Payment/SC_Helper_Payment_TestBase.php (1)
3-5: ライセンスヘッダーの配置を確認してください。
require_once文がライセンスヘッダーよりも前に配置されています。通常、ライセンスヘッダーはファイルの先頭(<?phpの直後)に配置されることが慣例です。📝 提案される修正
<?php - -$HOME = realpath(__DIR__).'/../../../..'; -require_once $HOME.'/tests/class/Common_TestCase.php'; /* * This file is part of EC-CUBE * * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. ... */ + +$HOME = realpath(__DIR__).'/../../../..'; +require_once $HOME.'/tests/class/Common_TestCase.php';tests/class/helper/SC_Helper_Payment/SC_Helper_Payment_staticMethodsTest.php (1)
10-29:memo03フィールドのデフォルト値が設定されていません。Line 25-28 で作成される「クレジットカード」の支払方法には
memo03が指定されていません。SC_Helper_Payment_TestBase::createPaymentData()のデフォルト値にもmemo03は含まれていないため、NULLとして挿入される可能性があります。これが意図的な動作であれば問題ありませんが、
useModule()のテストでmemo03が空の場合とNULLの場合で動作が異なる可能性があるため、明示的に設定することを推奨します。📝 提案される修正
$this->createPaymentData([ 'payment_id' => 3, 'payment_method' => 'クレジットカード', + 'memo03' => '', // または null を明示的に指定 ]);data/class/util/SC_Utils.php (1)
1109-1110: 年のフォーマットに軽微な不整合があります。
sfGetTimestamp()(Line 269) では%04dを使用していますが、sfTermMonth()では%dを使用しています。一貫性のため%04dに統一することを推奨します。実用上は問題ありませんが、将来のメンテナンス性を考慮した提案です。♻️ 年フォーマットの統一案
- $start_date = sprintf('%d-%02d-%02d', $start_year, $start_month, $start_day); - $end_date = sprintf('%d-%02d-%02d 23:59:59', $end_year, $end_month, $end_day); + $start_date = sprintf('%04d-%02d-%02d', $start_year, $start_month, $start_day); + $end_date = sprintf('%04d-%02d-%02d 23:59:59', $end_year, $end_month, $end_day);html/install/sql/create_table_sqlite3.sql (1)
1-106: スキーマファイルのフォーマットについて。すべてのCREATE TABLE文が1行に記述されており、可読性が低くなっています。将来のメンテナンス性向上のため、各カラムを改行で区切るフォーマットを検討してください。ただし、これは機能には影響しないため、優先度は低いです。
eccube_install.sh (1)
168-176: シーケンステーブルの初期化ロジックは正しいですが、コメントを補足できます。SQLite3のAUTOINCREMENTは、テーブルに挿入された最大rowid+1から採番されます。9999を挿入後に削除することで、次のINSERTが10000から始まるのは正しい動作です。
ただし、将来のメンテナンス者のために、コメントをより明確にすることを推奨します。
📝 コメント改善案
sqlite3 ) - # SQLite3: AUTOINCREMENT付きテーブルを作成し、初期値を9999に設定 - # 次のINSERTでsequence=10000から始まる + # SQLite3: AUTOINCREMENT付きテーブルを作成 + # AUTOINCREMENTは「過去に挿入された最大値+1」から採番するため、 + # 9999を挿入→削除することで、次のINSERTが10000から始まる sql=$(echo "CREATE TABLE IF NOT EXISTS ${S} (dockerbuild/wait-for-sqlite3.sh (1)
22-24: DB ファイルの権限を最小権限化することを検討してください。
chmod o+wにより world-writable になるため、chown www-data+chmod g+wなどで権限を絞る方が安全です。
tests/class/helper/SC_Helper_Delivery/SC_Helper_Delivery_saveTest.php
Outdated
Show resolved
Hide resolved
tests/class/helper/SC_Helper_Mailtemplate/SC_Helper_Mailtemplate_saveTest.php
Show resolved
Hide resolved
- dtb_tax_rule.create_date に DEFAULT を追加 - SC_Helper_Bloc_deleteTest: non_deletable_bloc.tpl を明示的に削除 - SC_Helper_Bloc_TestBase: file_put_contents の戻り値チェック追加 - SC_Helper_Delivery_saveTest: SELECT に ORDER BY 追加、未使用変数削除 - SC_Helper_Mailtemplate_saveTest: DateTime で日時比較 - SC_Helper_Session_TestBase: CURRENT_TIMESTAMP を date() に変更 - SC_DB_DBFactory_MYSQLTest: sfChangeArrayToString テスト追加 - SC_DB_DBFactory_SQLITE3Test: sfChangeArrayToString テスト追加 - README.md: SQLite3 サポートをドキュメントに追加 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PHP 8.0 関数(str_contains 等)が PHP 7.4 でも使用可能であることを GitHub Copilot のレビュー指針に追加 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
setOrder() を使用するよう修正 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@nanasess 一通り対応しました |
コードレビュー: BC Break の指摘このPRには以下の後方互換性に影響する変更が含まれています。 1. 日付フォーマットの変更 (Y/m/d → Y-m-d)以下の関数の戻り値フォーマットが変更されます:
影響: スラッシュ区切りを前提としたパース処理を行っている外部プラグインやカスタマイズに影響する可能性があります。 2.
|
nanasess
left a comment
There was a problem hiding this comment.
LGTM
日付フォーマットが変更されているため、念のため BC Break としました
Summary
Changes
Core: SQLite3 Database Factory (
SC_DB_DBFactory_SQLITE3)ILIKE→LIKE,TRUNC→TRUNCATE,ARRAY_TO_STRING→GROUP_CONCATCURRENT_TIMESTAMP/Now()→datetime('now','localtime')変換(UTC→ローカルタイム)EXTRACT(field FROM column)→CAST(strftime(format, column) AS INTEGER)変換concatColumn():||演算子による文字列連結getDownloadableDaysWhereSql(),getOrderYesterdaySql(),getOrderMonthSql(),getReviewYesterdaySql(),getSendHistoryWhereStartdateSql(): SQLite3用SQL生成addLimitOffset(): OFFSET使用時のLIMIT自動付与(SQLite3制約対応)Core: Query & SQL Compatibility
SC_Query::insert(): FROM句なし時のINSERT...VALUES構文切り替え(SQLite3互換)SC_SelectSql::selectTermRange(): 日付セパレータを/→-に変更(SQLite3のdate()関数互換)SC_Helper_Purchase::registerShipping(): 日付保存形式に時刻を含める(TEXT型互換)SC_Query: 大きな配列のエラーログでメモリ枯渇を防止Infrastructure
create_table_sqlite3.sql: 全テーブル定義(DEFAULT (datetime('now','localtime'))でローカルタイム)eccube_install.sh: SQLite3インストールモード追加docker-compose.sqlite3.yml/wait-for-sqlite3.sh: Docker対応 (WALモード有効化).github/workflows/unit-tests.yml: CI/CDマトリクスにsqlite3を追加Tests
Security Review
addLimitOffset(): LIMIT/OFFSETに(int)キャスト追加(SQLi対策)wait-for-sqlite3.sh:getenv()使用に変更(コマンドインジェクション対策)Test plan
eccube_install.sh sqlite3でローカルインストール成功🤖 Generated with Claude Code
Summary by CodeRabbit
新機能
ドキュメント
修正 / 改良
テスト
✏️ Tip: You can customize this high-level summary in your review settings.