Let it work with Laravel v12.53.0#35
Closed
waldemar-p wants to merge 5 commits into
Closed
Conversation
Update minimum requirements to PHP 8.2 and Statamic 6.0. Replace Laravel Mix with Vite for asset compilation. Include asset publishing instructions in README.
Laravel v12.53.0 (Feb 2026) introduced a serializable_classes config for cache stores (laravel/framework#58911) that restricts which PHP classes can be deserialized. When active, unserialize() rejects any class not on an explicit allowlist, turning it into __PHP_Incomplete_Class. Statamic v6.5.0 added Laravel 13 support, and upgrading Statamic also pulled in Laravel 12.53+ where this feature became available. The first manifestation of this issue appeared around Statamic v6.8.0: the addon stored Icons, Icon, Kit, and Collection objects via Cache::rememberForever(), which uses PHP serialize(). After the Laravel update, these classes were not on the serialization allowlist and became __PHP_Incomplete_Class upon retrieval. Statamic v6.10.0 (statamic/cms#14416) explicitly added Statamic's own classes to the allowlist, but third-party addon classes are not included. This made the error persistent rather than intermittent. Additionally, Statamic's GraphQL DefaultCache serializes the entire JsonResponse object via Cache::put(). Objects nested in the Response that are not on the allowlist also produce __PHP_Incomplete_Class, breaking GraphQL response caching entirely. On top of this, serializing the large icon collection (thousands of objects) caused memory exhaustion on sites with standard PHP memory limits. Changes: - Replace Cache::rememberForever() with JSON file caching for icons, kit data, and styles. Cache files are stored in storage/framework/cache/font-awesome/ as plain JSON — no PHP serialization involved. - Use streaming writes (fwrite per icon) for the icon cache to reduce peak memory usage when writing large icon collections. - Add a separate styles cache so styles() no longer loads the full icon collection — just a small JSON array of style names. - Serve cached icons JSON directly from disk via response()->file() in the controller, avoiding object instantiation entirely. - Add instance-level $cachedIcons property to prevent redundant file reads within a single request. - Introduce SafeResponseCache implementing Statamic's ResponseCache contract. Caches only the content string, status code, and headers array — all plain scalars — instead of the full Response object. Bound in ServiceProvider::boot() to override Statamic's DefaultCache which binds in register().
Contributor
Author
|
I created an issue and a PR on statamic cms for the support of objects as modelValues inside the combobox. |
Owner
|
Thanks for flagging these issues! I've addressed them in v4.0.1 across three separate PRs:
If I missed anything or you're still running into issues, feel free to open a new issue or PR. |
Contributor
Author
|
I still get an error and I think it has to do with the cache handling. But that is probably an error inside of statamic itself, right? Even though with the code I provided, it worked because it has overwritten some ResponseCache methods. |
Owner
|
Yeah, not an issue of this addon. I didn't run into it myself. Maybe update Laravel and Statamic. |
Contributor
Author
|
Thanks, you're right. That bug was resolved on statamic/cms 6.11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I think with Statamic 6.5 cam Laravel v12.53.0 and with that came a serializable_classes config.
If I am not mistaken that lead to some __PHP_Incomplete_Class errors upwards Statamic 6.5 ( I tried it from 6.8).
I tried to resolve that issue and also tried to lessen the memory footprint, because there are uses with a lot of font-awesome icons and that gets big quite fast. I know have a 53k lines json file as cache instead.
This version now worked for me but I am unsure if I went with the correct approach.
I also fixed a problem with the selected-option class property.