Skip to content
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

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

Closed
mehulboricha opened this issue Mar 13, 2020 · 11 comments

Comments

@mehulboricha
Copy link

mehulboricha commented Mar 13, 2020

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}

@mehulboricha mehulboricha changed the title Cleaning up the backups of XXXXX failed | After Upgrading from Laravel 5.8 to 6.X Cleaning up the backups of XXXXX failed | After Upgrading from Laravel 5.8 to 6.X 7 From PHP 7.3 to PHP 7.4 Mar 13, 2020
@mehulboricha mehulboricha changed the title Cleaning up the backups of XXXXX failed | After Upgrading from Laravel 5.8 to 6.X 7 From PHP 7.3 to PHP 7.4 Cleaning up the backups of XXXXX failed | After Upgrading from Laravel 5.8 to 6.X & From PHP 7.3 to PHP 7.4 Mar 13, 2020
@freekmurze
Copy link
Member

What is the full error message?

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

@mehulboricha
Copy link
Author

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

@mehulboricha
Copy link
Author

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

@freekmurze
Copy link
Member

freekmurze commented Mar 13, 2020

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

@mehulboricha
Copy link
Author

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

@freekmurze
Copy link
Member

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.

@mehulboricha
Copy link
Author

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

@freekmurze
Copy link
Member

Yes

@freearhey
Copy link

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

@mehulboricha
Copy link
Author

mehulboricha commented Mar 22, 2020

Hey there,

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

@Udsupun
Copy link

Udsupun commented Jun 22, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants