Commit 93a8def
* fix: 🐛 serialize cache values to fix Cacheable with serializable_classes
When Laravel's `cache.serializable_classes` is set to `false` (or a
restricted array), PHP's `unserialize()` converts stored Eloquent models
into `__PHP_Incomplete_Class` objects, making cached results unusable.
ModelCacheRepository now wraps every stored value with a sentinel prefix
(`genealabs:lmc:v1:serialized:`) and explicit `serialize()`/`unserialize()`
calls, bypassing the driver-level `allowed_classes` restriction entirely.
The transparent `makeCacheDeserializeProxy` in test infrastructure
auto-deserializes values so existing tests need no per-call changes.
Closes #588
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: ✅ verify serializable_classes=true and dedupe deserialization helper
Addresses tracer bullet review feedback on #589:
- Added test_cacheable_trait_works_when_serializable_classes_is_true to
exercise the Cacheable trait under the actual restriction the bug
reports. Existing tests set the config to false before caching, which
never proved the fix. Updated the "under restriction" test to set
serializable_classes=true *before* the cached calls.
- Extracted deserializeCacheValue helper on CreatesApplication so the
prefix-detection logic lives in one place. DynamoDbModelCachingTest now
calls the helper instead of duplicating the unserialize incantation.
- Verified ModelCacheRepository has no remember(\$ttl) method — only
get/rememberForever/forever/forget — so all write paths are already
covered by the prefix wrapping in PR #589.
* test: ✅ Brought all tests back to green.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b16d2a9 commit 93a8def
File tree
8 files changed
+11225
-24
lines changed- src/Cache
- tests
- Integration
- Traits
8 files changed
+11225
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
80 | | - | |
81 | | - | |
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
0 commit comments