Laravel-backup: Cleaning up the backups of XXXXX failed | After Upgrading from Laravel 5.8 to 6.X & From PHP 7.3 to PHP 7.4

Created on 13 Mar 2020  路  11Comments  路  Source: spatie/laravel-backup

Using "spatie/laravel-backup": "^6.8"

Error: [Sensitive Fields Hidden]

Exception message: Trying to access array offset on value of type null

Exception trace: #0 XXXXXXXXXXX/public_html/vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(47): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 XXXXXXXXXXX/public_html/vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(22): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->calculateDateRanges() #2 XXXXXXXXXXX/public_html/vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(42): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->deleteOldBackups() #3 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php(176): Spatie\Backup\Tasks\Cleanup\CleanupJob->Spatie\Backup\Tasks\Cleanup{closure}() #4 XXXXXXXXXXX/public_html/vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(54): Illuminate\Support\Collection->each() #5 XXXXXXXXXXX/public_html/vendor/spatie/laravel-backup/src/Commands/CleanupCommand.php(42): Spatie\Backup\Tasks\Cleanup\CleanupJob->run() #6 [internal function]: Spatie\Backup\Commands\CleanupCommand->handle() #7 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array() #8 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(36): Illuminate\Container\BoundMethod::Illuminate\Container{closure}() #9 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\Util::unwrapIfClosure() #10 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod() #11 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(590): Illuminate\Container\BoundMethod::call() #12 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\Container\Container->call() #13 XXXXXXXXXXX/public_html/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute() #14 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run() #15 XXXXXXXXXXX/public_html/vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(16): Illuminate\Console\Command->run() #16 XXXXXXXXXXX/public_html/vendor/symfony/console/Application.php(1001): Spatie\Backup\Commands\BaseCommand->run() #17 XXXXXXXXXXX/public_html/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand() #18 XXXXXXXXXXX/public_html/vendor/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun() #19 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run() #20 XXXXXXXXXXX/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Console\Application->run() #21 XXXXXXXXXXX/public_html/artisan(37): Illuminate\Foundation\Console\Kernel->handle() #22 {main}

All 11 comments

What is the full error message?

I'm guessing this is related to cached config. Did you clear the config cache?

I have set up an email kind of thing whenever an exception occurs. This was the content of the email.

I have already cleared the config cache but this is still happening.

Exception message: Trying to access array offset on value of type null

PS: Forgot to add the exception message

I am pretty sure that this is related to upgrading to PHP 7.4

Souce: https://www.php.net/manual/en/migration74.incompatible.php

Section: Array-style access of non-arrays

Strange, our test suite does run ok on PHP 7.4
https://github.com/spatie/laravel-backup/actions/runs/55185565

Can you guide me on how to get into the root of this and find what is causing the issue? Is the version of laravel backup I am using correct?

Using "spatie/laravel-backup": "^6.8" | in composer.json

Unfortunately I don't have the time to look into specific projects. You could try getting some help on Laravel.io or the Laracasts forum.

Okay no problem. Just tell me is the version of laravel-backup I mentioned earlier is compatible with PHP 7.4 or not?

Yes

I think this issue is related: #981

And the problem is most likely in config/backup.php. At least that's what I had. It was necessary to update all the keys in the config as it says here: https://github.com/spatie/laravel-backup/blob/master/UPGRADING.md

Hey there,

A few days back I replaced the backup.php from the original source. It worked. Thanks :D

Check whether all the keys in the config/backup.php file is in snake_case.
ex. deleteOldestBackupsWhenUsingMoreMegabytesThan
should change to delete_oldest_backups_when_using_more_megabytes_than

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andaril picture andaril  路  3Comments

itzikbenh picture itzikbenh  路  3Comments

holymp2006 picture holymp2006  路  4Comments

laurencei picture laurencei  路  4Comments

KHucks picture KHucks  路  3Comments