The code was working as expected in PHP 7.4 and crashed immediately upon upgrading my system to PHP 8. It appears the mb_convert_encoding function changed slightly in PHP 8 and crashes when $this->settings->inputEncodings is a empty array. At SourceRow.php line 118 this change corrects the issue (longhand for clarity)
After upgrading to PHP 8/ Laravel 8 i received the following error while seeding:
SpreadsheetSeeder: File: gosDefault.xlsx Sheet: menuItems Row: 2 24.8 MB 0 s
ValueError
mb_convert_encoding(): Argument #3 ($from_encoding) must specify at least one encoding
at vendor/bfinlay/laravel-excel-seeder/src/SourceRow.php:118 114▕ return $value; 115▕ } 116▕ 117▕ private function encode($value) { ➜ 118▕ if( is_string($value) ) $value = mb_convert_encoding($value, $this->settings->outputEncoding, $this->settings->inputEncodings); 119▕ return $value; 120▕ } 121▕ 122▕ private function hash($columnName, $value) {
10 database/seeders/menuData_seeder.php:22 bfinlay\SpreadsheetSeeder\SpreadsheetSeeder::run()
18 database/seeders/DatabaseSeeder.php:18 Illuminate\Database\Seeder::call("Database\Seeders\menuData_seeder")
The code was working as expected in PHP 7.4 and crashed immediately upon upgrading my system to PHP 8. It appears the mb_convert_encoding function changed slightly in PHP 8 and crashes when $this->settings->inputEncodings is a empty array. At SourceRow.php line 118 this change corrects the issue (longhand for clarity)
or
in SpreadsheetSeederSettings.php Line 188
public $inputEncodings = null;
Corrects the problem.