Skip to content

Fix CacheMap when cache is corrupted#169

Open
villfa wants to merge 1 commit intoLaravel-Backpack:mainfrom
villfa:fix/cache-map-type-error
Open

Fix CacheMap when cache is corrupted#169
villfa wants to merge 1 commit intoLaravel-Backpack:mainfrom
villfa:fix/cache-map-type-error

Conversation

@villfa
Copy link

@villfa villfa commented Mar 9, 2026

Hi,

The goal of this PR is to prevent errors of this sort:

TypeError: Cannot assign null to property Backpack\Basset\Helpers\CacheMap::$map of type array

/vendor/backpack/basset/src/Helpers/CacheMap.php:31
/vendor/backpack/basset/src/BassetManager.php:45
/vendor/backpack/basset/src/BassetServiceProvider.php:72
/vendor/laravel/framework/src/Illuminate/Container/Container.php:952
/vendor/laravel/framework/src/Illuminate/Container/Container.php:832
/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1078
/vendor/laravel/framework/src/Illuminate/Container/Container.php:763
/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1058
/vendor/laravel/framework/src/Illuminate/Container/Container.php:1580
/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:239
/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:210
/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:355
/vendor/backpack/crud/src/BackpackServiceProvider.php:65
[...]

I observed this error in very rare occasions so I'm not sure how to reproduce.

Copy link
Contributor

@pxpm pxpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @villfa !

I agree we can gracefully handle the corrupt map files. Since we are changing it, I am tempted to use a more fool proof to handle other generic errors that might happen with the file read.

What you think ? Willing to do the changes in the PR ?

Cheers

@pxpm pxpm moved this to In Review in Backpack v7.0 Mar 9, 2026
@villfa villfa force-pushed the fix/cache-map-type-error branch from 13974da to 5524d8f Compare March 9, 2026 12:20
@villfa villfa requested a review from pxpm March 9, 2026 12:22
@villfa
Copy link
Author

villfa commented Mar 9, 2026

BTW, would it be possible to cherry-pick this change and make a 1.3.10 release?

I won't be able to migrate to Backpack v7 for a few months, so it would be great to benefit from this fix in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants