goodby / csv

Goodby CSV is a high memory efficient flexible and extendable open-source CSV import/export library for PHP 5.3. 1. Memory Management Free This library designed for memory unbreakable. It will not be accumulated in the memory whole rows. The importer read CSV file and execute callback function line by line. 2. Multibyte support This library supports mulitbyte input/output: for example, SJIS-win, EUC-JP and UTF-8. 3. Ready to Use for Enterprise Applications Goodby CSV is fully unit-tested. The library is stable and ready to be used in large projects like enterprise applications.
MIT License
955 stars 148 forks source link

Add compatibility for PHP 8.1 #87

Open alexander-schranz opened 3 years ago

alexander-schranz commented 3 years ago

Additonal parameter was added and fputcsv has a returntype of int|false now. For cross support php version support I added the #[ReturnTypeWillChange] attribute.

Example:

Errors:

php -r 'class CsvFileObject extends SplFileObject
{
public function fputcsv($fields, $delimiter = null, $enclosure = null, $escape = null, $eol = null){}
}'

PHP Deprecated: Return type of CsvFileObject::fputcsv($fields, $delimiter = null, $enclosure = null, $escape = null, $eol = null) should either be compatible with SplFileObject::fputcsv(array $fields, string $separator = ",", string $enclosure = "\"", string $escape = "\", string $eol = "\n"): int|false, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Command line code on line 3

Fix:

php -r 'class CsvFileObject extends SplFileObject
{
#[ReturnTypeWillChange]
public function fputcsv($fields, $delimiter = null, $enclosure = null, $escape = null, $eol = null){}
}'
alexander-schranz commented 2 years ago

Merged into fork: https://github.com/handcraftedinthealps/goodby-csv/pull/1