-
Notifications
You must be signed in to change notification settings - Fork 680
deprecated の警告を修正 #6378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.3
Are you sure you want to change the base?
deprecated の警告を修正 #6378
Conversation
…deprecation Fixes PHP 8.4 deprecation: fputcsv(): the $escape parameter must be provided as its default value will change ``` 1012x: fputcsv(): the $escape parameter must be provided as its default value will change 909x in CsvImportControllerTest::testSplitCsv from Eccube\Tests\Web\Admin\Product 12x in CategoryControllerTest::testExport from Eccube\Tests\Web\Admin\Product 12x in CsvImportControllerTest::testCsvImportWithExistsProductsExceptOptionalColumns from Eccube\Tests\Web\Admin\Product 12x in CsvImportControllerTest::testImportTaxRule from Eccube\Tests\Web\Admin\Product 11x in CustomerControllerTest::testExport from Eccube\Tests\Web\Admin\Customer ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes several deprecation warnings triggered by passing null values to PHP functions and adjusts sorting comparators to return integers rather than booleans. It also improves CSV handling by providing explicit parameters for functions such as fputcsv.
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/Eccube/Twig/Extension/SafeTextmailEscaperExtension.php | Added null coalescing for string replacement to avoid deprecation warnings. |
src/Eccube/Twig/Extension/EccubeExtension.php | Ensured a default numeric value is provided to formatCurrency. |
src/Eccube/Service/PurchaseFlow/ItemCollection.php | Replaced boolean comparator with the spaceship operator for accurate sorting. |
src/Eccube/Service/PluginService.php | Added commas and a defensive isset check for file operations; adjusted plugin manager class string concatenation. |
src/Eccube/Service/OrderPdfService.php | Guarded postal code processing against empty/null strings. |
src/Eccube/Service/CsvImportService.php | Removed deprecated ini_set call. |
src/Eccube/Service/CsvExportService.php | Updated fputcsv call to include proper escape parameters. |
src/Eccube/Form/Type/* | Added null-coalescing and guard clauses for preg_split in various form types. |
src/Eccube/Form/EventListener/* | Introduced is_string checks to ensure safe processing of user input. |
src/Eccube/Entity/Product.php | Updated PHPDoc annotations and simplified usort comparators. |
src/Eccube/Controller/* | Ensured type validation on inputs and added missing commas in parameter lists. |
codeception/_support/Page/Admin/OrderManagePage.php | Adjusted comparator logic for correct sorting order. |
- Line ending conversion is already handled by ConvertLineFeedFilter
fix(util): handle null values in StringUtil trim# modified: tests/bootstrap.php method Ensure# .github/prompts/ the `trim` function handles null values gracefully by# .phpactor.yml using the null coalescing operator.# app/config/eccube/packages/dev/maker.yaml
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.3 #6378 +/- ##
==========================================
- Coverage 82.83% 82.83% -0.01%
==========================================
Files 480 480
Lines 27094 27117 +23
==========================================
+ Hits 22443 22462 +19
- Misses 4651 4655 +4
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:
|
概要(Overview・Refs Issue)
以下の警告を修正
SplFileObject::fputcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl()
preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated
mb_convert_kana(): Passing null to parameter #1 ($string) of type string is deprecated
auto_detect_line_endings is deprecated
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero
file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated
preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated
NumberFormatter::formatCurrency(): Passing null to parameter #1 ($amount) of type float is deprecated
fgetcsv(): the $escape parameter must be provided as its default value will change
mb_substr(): Passing null to parameter #1 ($string) of type string is deprecated
strlen(): Passing null to parameter #1 ($string) of type string is deprecated
trim(): Passing null to parameter #1 ($string) of type string is deprecated
方針(Policy)
実装に関する補足(Appendix)
以下を実行すると、非推奨警告の出るタイミングでスタックトレースを出力するので、修正箇所を把握しやすい
テスト(Test)
PHPUnit で PHP 関数の非推奨警告が出力されないのを確認
相談(Discussion)
マイナーバージョン互換性保持のための制限事項チェックリスト
レビュワー確認項目