fix #3938 fgetcsvRegによるCSV読み込み時に正常にデータを読み取れない場合がある件を修正#4409
Open
kaburk wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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・埋め込み引用符・長大な引用符に関する回帰テストを追加 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
よろしくお願いします!