Laravel-Excel icon indicating copy to clipboard operation
Laravel-Excel copied to clipboard

[Bug]: ZipArchive::getFromName(): Invalid or uninitialized Zip object in

Open farshadff opened this issue 3 years ago • 1 comments
trafficstars

Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?

  • [X] Yes, it's still reproducable

What version of Laravel Excel are you using?

3.1.30

What version of Laravel are you using?

7.1.10

What version of PHP are you using?

8.1.0

Describe your issue

hi there , i have an export class that is working fine on like ~16k data and it always returns the file correctly . but when the data amount gets to much i receive this error :

ErrorException: ZipArchive::getFromName(): Invalid or uninitialized Zip object in /var/www//vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php:303
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'ZipArchive::get...', '/var/www//...', 303, Array)
#1 /var/www//vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php(303): ZipArchive->getFromName('_rels/.rels', 0, 1)
#2 /var/www//vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php(2018): PhpOffice\PhpSpreadsheet\Reader\Xlsx->getFromZipArchive(Object(ZipArchive), '_rels/.rels')
#3 /var/www//vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php(336): PhpOffice\PhpSpreadsheet\Reader\Xlsx->getWorkbookBaseName(Object(ZipArchive))
#4 /var/www//vendor/maatwebsite/excel/src/Writer.php(111): PhpOffice\PhpSpreadsheet\Reader\Xlsx->load('/var/www//...')
#5 /var/www//vendor/maatwebsite/excel/src/Jobs/AppendQueryToSheet.php(90): Maatwebsite\Excel\Writer->reopen(Object(Maatwebsite\Excel\Files\LocalTemporaryFile), 'Xlsx')
#6 /var/www//vendor/maatwebsite/excel/src/Jobs/Middleware/LocalizeJob.php(46): Maatwebsite\Excel\Jobs\AppendQueryToSheet->Maatwebsite\Excel\Jobs\{closure}(Object(Maatwebsite\Excel\Jobs\AppendQueryToSheet))
#7 /var/www//vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php(19): Maatwebsite\Excel\Jobs\Middleware\LocalizeJob->Maatwebsite\Excel\Jobs\Middleware\{closure}()
#8 /var/www//vendor/maatwebsite/excel/src/Jobs/Middleware/LocalizeJob.php(47): Maatwebsite\Excel\Jobs\Middleware\LocalizeJob->withLocale(NULL, Object(Closure))
#9 /var/www//vendor/maatwebsite/excel/src/Jobs/AppendQueryToSheet.php(99): Maatwebsite\Excel\Jobs\Middleware\LocalizeJob->handle(Object(Maatwebsite\Excel\Jobs\AppendQueryToSheet), Object(Closure))
#10 [internal function]: Maatwebsite\Excel\Jobs\AppendQueryToSheet->handle(Object(Maatwebsite\Excel\Writer))
#11 /var/www//vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
#12 /var/www//vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#13 /var/www//vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#14 /var/www//vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#15 /var/www//vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
#16 /var/www//vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Maatwebsite\Excel\Jobs\AppendQueryToSheet))
#17 /var/www//vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Maatwebsite\Excel\Jobs\AppendQueryToSheet))
#18 /var/www//vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#19 /var/www//vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(49): Illuminate\Bus\Dispatcher->dispatchNow(Object(Maatwebsite\Excel\Jobs\AppendQueryToSheet), false)
#20 /var/www//vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(88): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#21 /var/www//vendor/laravel/framework/src/Illuminate/Queue/Worker.php(337): Illuminate\Queue\Jobs\Job->fire()
#22 /var/www//vendor/laravel/framework/src/Illuminate/Queue/Worker.php(283): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions))
#23 /var/www//vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Illuminate\Queue\WorkerOptions))
#24 /var/www//vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker->daemon('redis', 'default,emails,...', Object(Illuminate\Queue\WorkerOptions))
#25 /var/www//vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default,emails,...')
#26 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#27 /var/www//vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
#28 /var/www//vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#29 /var/www//vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#30 /var/www//vendor/laravel/framework/src/Illuminate/Container/Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#31 /var/www//vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)
#32 /var/www//vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#33 /var/www//vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#34 /var/www//vendor/symfony/console/Application.php(1009): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /var/www//vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 /var/www//vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#37 /var/www//vendor/laravel/framework/src/Illuminate/Console/Application.php(90): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#38 /var/www//vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(133): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#39 /var/www//artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#40 {main}

i tried the file permission , it has all the permissions it needs and as i said its working on low amount of data .

How can the issue be reproduced?

use this package for exporting huge amount of rows like ~60k

What should be the expected behaviour?

when using queue it should work for large data .

farshadff avatar Jul 09 '22 08:07 farshadff

Try to provide a failing unit tests, I can't reproduce it with any amount of row size, so it seems very related to your application.

patrickbrouwers avatar Jul 28 '22 08:07 patrickbrouwers

This bug report has been automatically closed because it has not had recent activity. If this is still an active bug, please comment to reopen. Thank you for your contributions.

stale[bot] avatar Sep 28 '22 18:09 stale[bot]