Skip to content

Conversation

mathiasgrimm
Copy link
Contributor

@mathiasgrimm mathiasgrimm commented Oct 2, 2025

Enhanced ConfigCacheCommand to provide precise error messages when configuration values cannot be serialized during caching. When serialization fails, the command now iterates through the flattened config array to identify the exact configuration key containing the non-serializable value, rather than throwing a generic error.

The improved error messages help developers quickly locate and fix configuration issues when running php artisan config:cache or php artisan optimize.

Before

Your configuration files are not serializable.

After

Your configuration files could not be serialized because the value at "testconfig.nested.deep.closure" is non-serializable.

…essages for non-serializable values

Enhanced ConfigCacheCommand to provide precise error messages when configuration values cannot be serialized during caching.
When serialization fails, the command now iterates through the flattened config array to identify the exact configuration key containing the non-serializable value, rather than throwing a generic error.

The improved error messages help developers quickly locate and fix configuration issues when running `php artisan config:cache` or `php artisan optimize`.

## Previously
```
Your configuration files are not serializable.
```

## Now
```
Your configuration files could not be serialized because The value at "testconfig.nested.deep.closure" contains a non-serializable type.
```
…essages for non-serializable values

Enhanced ConfigCacheCommand to provide precise error messages when configuration values cannot be serialized during caching.
When serialization fails, the command now iterates through the flattened config array to identify the exact configuration key containing the non-serializable value, rather than throwing a generic error.

The improved error messages help developers quickly locate and fix configuration issues when running `php artisan config:cache` or `php artisan optimize`.

## Previously
```
Your configuration files are not serializable.
```

## Now
```
Your configuration files could not be serialized because The value at "testconfig.nested.deep.closure" contains a non-serializable type.
```
@mathiasgrimm mathiasgrimm changed the title Improve php artisan config:cache and php artisan optimize error messages for non-serializable values [12.x] Improve php artisan config:cache and php artisan optimize error messages for non-serializable values Oct 2, 2025
…essages for non-serializable values

Enhanced ConfigCacheCommand to provide precise error messages when configuration values cannot be serialized during caching.
When serialization fails, the command now iterates through the flattened config array to identify the exact configuration key containing the non-serializable value, rather than throwing a generic error.

The improved error messages help developers quickly locate and fix configuration issues when running `php artisan config:cache` or `php artisan optimize`.

## Previously
```
Your configuration files are not serializable.
```

## Now
```
Your configuration files could not be serialized because the value at "testconfig.nested.deep.closure" contains a non-serializable type.
```
…essages for non-serializable values

Enhanced ConfigCacheCommand to provide precise error messages when configuration values cannot be serialized during caching.
When serialization fails, the command now iterates through the flattened config array to identify the exact configuration key containing the non-serializable value, rather than throwing a generic error.

The improved error messages help developers quickly locate and fix configuration issues when running `php artisan config:cache` or `php artisan optimize`.

## Previously
```
Your configuration files are not serializable.
```

## Now
```
Your configuration files could not be serialized because the value at "testconfig.nested.deep.closure" contains a non-serializable type.
```
…essages for non-serializable values

Enhanced ConfigCacheCommand to provide precise error messages when configuration values cannot be serialized during caching.
When serialization fails, the command now iterates through the flattened config array to identify the exact configuration key containing the non-serializable value, rather than throwing a generic error.

The improved error messages help developers quickly locate and fix configuration issues when running `php artisan config:cache` or `php artisan optimize`.

## Previously
```
Your configuration files are not serializable.
```

## Now
```
Your configuration files could not be serialized because the value at "testconfig.nested.deep.closure" is non-serializable.
```
@taylorotwell
Copy link
Member

Not sure I wanna eval. 😅

@taylorotwell taylorotwell reopened this Oct 3, 2025
@taylorotwell taylorotwell merged commit 652cc51 into 12.x Oct 3, 2025
126 checks passed
@taylorotwell taylorotwell deleted the better-error-config-cache branch October 3, 2025 09:24
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

Successfully merging this pull request may close these issues.

2 participants