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

Your configuration files are not serializable. #9814

Closed
eness opened this issue May 18, 2024 · 3 comments
Closed

Your configuration files are not serializable. #9814

eness opened this issue May 18, 2024 · 3 comments
Labels
Bug Fixed When bug issue is fixed. Bug Something isn't working.

Comments

@eness
Copy link
Contributor

eness commented May 18, 2024

Describe the bug

php artisan config:cache not work because of closure's used in config files.

In Laravel, configuration files are meant to be simple PHP arrays, and they are loaded very early in the application's lifecycle. This means that the service container (which is responsible for resolving and managing class dependencies) is not yet fully available when configuration files are loaded. Therefore, you can't directly access the service container within configuration files.

If you need to access dynamic values from the service container and want to ensure they are only computed or resolved when needed, a good approach is to use closures or functions within the configurations that are evaluated at runtime. This means moving the logic that depends on the service container to the place where these values are actually used.

To Reproduce
Steps to reproduce the behavior:

  1. Install fresh Bagisto
  2. Execute php artisan config:cache
  3. See error

Expected behavior

Caching config values without errors.

Screenshots

image

Lines that causes the error :

packages/Admin/src/config/system.php

image

@jitendra-webkul
Copy link
Member

We will address this issue soon.

jitendra-webkul added a commit to jitendra-webkul/bagisto that referenced this issue May 20, 2024
@jitendra-webkul jitendra-webkul added Bug Something isn't working. Bug Fixed When bug issue is fixed. labels May 20, 2024
@jitendra-webkul
Copy link
Member

I have fixed this issue, please verify

@eness
Copy link
Contributor Author

eness commented May 20, 2024

the issue seems to be solved.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fixed When bug issue is fixed. Bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants