Skip to content

Commit 9aadbfb

Browse files
jasonvargaclaude
andcommitted
Fix serializable_classes handling when config is false
When serializable_classes is false (Laravel 13 default), the guard treated it the same as null/true and skipped registration. But false means "restrict to no classes", so unserialize() blocked all Stache objects. Now only null and true (both unrestricted) are skipped. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a369347 commit 9aadbfb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Providers/AddonServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,11 +721,11 @@ protected function registerSerializableClasses(array $classes)
721721
{
722722
$existing = $this->app['config']->get('cache.serializable_classes');
723723

724-
if (! is_array($existing)) {
724+
if ($existing === null || $existing === true) {
725725
return;
726726
}
727727

728-
$this->app['config']->set('cache.serializable_classes', array_merge($existing, $classes));
728+
$this->app['config']->set('cache.serializable_classes', array_merge(is_array($existing) ? $existing : [], $classes));
729729
}
730730

731731
protected function schedule(Schedule $schedule)

src/Providers/AppServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ private function registerSerializableClasses()
239239
{
240240
$existing = $this->app['config']->get('cache.serializable_classes');
241241

242-
if (! is_array($existing)) {
242+
if ($existing === null || $existing === true) {
243243
return;
244244
}
245245

246-
$this->app['config']->set('cache.serializable_classes', array_merge($existing, [
246+
$this->app['config']->set('cache.serializable_classes', array_merge(is_array($existing) ? $existing : [], [
247247
\Statamic\Auth\File\User::class,
248248
\Statamic\Assets\Asset::class,
249249
\Statamic\Assets\AssetContainer::class,

0 commit comments

Comments
 (0)