Skip to content

fix #3938 fgetcsvRegによるCSV読み込み時に正常にデータを読み取れない場合がある件を修正#4409

Open
kaburk wants to merge 1 commit into
baserproject:5.2.xfrom
kaburk:5.2.x-#3938
Open

fix #3938 fgetcsvRegによるCSV読み込み時に正常にデータを読み取れない場合がある件を修正#4409
kaburk wants to merge 1 commit into
baserproject:5.2.xfrom
kaburk:5.2.x-#3938

Conversation

@kaburk

@kaburk kaburk commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

よろしくお願いします!

Copilot AI review requested due to automatic review settings June 4, 2026 15:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本PRは、BcDatabaseService::loadCsvToArray() における CSV 読み込み処理を見直し、fgetcsvReg 利用時に一部のCSVでデータを正常に読み取れないことがある問題(#3938)を修正するものです。特に SJIS 系エンコーディングや埋め込み引用符、長大な引用符を含む値の取り扱いの安定化を狙っています。

Changes:

  • loadCsvToArray() の読み込み処理を BcUtil::fgetcsvReg() から fgetcsv()(length制限なし・escape無効)へ切替
  • ヘッダが取得できない/空の場合の早期リターンを追加し、BOM除去処理をより明示的なバイト列指定に変更
  • SJIS-win の埋め込み引用符(例: 能""能)や長大な引用符でも列欠落しないことを確認するテストを追加

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
plugins/baser-core/src/Service/BcDatabaseService.php CSV読み込み処理を fgetcsv() ベースに変更し、空ヘッダ/BOMの扱いを改善
plugins/baser-core/tests/TestCase/Service/BcDatabaseServiceTest.php SJIS-win・埋め込み引用符・長大な引用符に関する回帰テストを追加

Comment thread plugins/baser-core/src/Service/BcDatabaseService.php Outdated
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