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

[Issue] Running php artisan optimize in PHP 8.2: Configuration Files Not Serializable #2138

Open
concetasolddev opened this issue Nov 13, 2024 · 1 comment

Comments

@concetasolddev
Copy link

Describe the bug
When trying to run php artisan optimize on PHP 8.2, the following error occurs:
Your configuration files are not serializable. This issue happens due to the use of closures in the configuration files, which are not serializable in PHP 8.2.

To Reproduce
Steps to reproduce the behavior:

Clone the NexoPOS repository.
Set up the environment (with PHP 8.2).
Run php artisan optimize
See the error:
Your configuration files are not serializable.

Expected behavior
The php artisan optimize command should run successfully without throwing any errors. The configuration files should be serializable in PHP 8.2.

Screenshots
NA

Solution
Replace the fn() closures in the config/accounting.php file with string-based labels or simple array values. Closures are not serializable in PHP 8.2, causing issues with configuration caching. By removing the closures and using direct values, the serialization issue is resolved.

Environment:
NexoPOS version: 5.3.1 (or the version you're using)
PHP version: 8.2
Premium Extensions: NA

@concetasolddev concetasolddev changed the title Error Running php artisan optimize in PHP 8.2: Configuration Files Not Serializable [Issue] Running php artisan optimize in PHP 8.2: Configuration Files Not Serializable Nov 15, 2024
@Blair2004
Copy link
Owner

Hi,
Indeed, with an anonymous function, it can't be serialized.
We'll consider a potential update there. we've used anonymous function to ensure translation are already loaded with it's called.

Blair2004 added a commit that referenced this issue Jan 7, 2025
- Fixed: Serialization issues #2138
- Added: preload procurements products
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

2 participants