Skip to content

fix: limit laravel/serializable-closure to <2.0.9#123

Open
esetnik wants to merge 2 commits intocrunzphp:3.9from
esetnik:fix/limit-serializable-closure-version
Open

fix: limit laravel/serializable-closure to <2.0.9#123
esetnik wants to merge 2 commits intocrunzphp:3.9from
esetnik:fix/limit-serializable-closure-version

Conversation

@esetnik
Copy link

@esetnik esetnik commented Feb 24, 2026

Summary

  • Constrains laravel/serializable-closure to >=2.0 <2.0.9 in composer.json to avoid a breaking change introduced in v2.0.9

Problem

laravel/serializable-closure v2.0.9 introduced a regression (laravel/serializable-closure#122) that modifies Native::wrapClosures() and Native::mapByReference() to skip walking object properties when the object implements __serialize. This prevents the library from finding and wrapping closures nested inside those objects, causing:

[Exception]
Serialization of 'Closure' is not allowed

I verified this across all available versions:

Version Result
v2.0.8 ✅ Works
v2.0.9 ❌ Broken
v2.0.10 ❌ Broken
2.x-dev ❌ Still broken

The upstream issue has been reported: laravel/serializable-closure#126

Fix

Constrains the laravel/serializable-closure dependency to >=2.0 <2.0.9 until the upstream regression is resolved.

Fixes #122

v2.0.9 introduced a change in Native.php (laravel/serializable-closure#122)
that skips walking object properties when the object implements __serialize.
This breaks crunz's closure serialization, causing "Serialization of
'Closure' is not allowed" errors in LaravelClosureSerializer::serialize().

Constrains the dependency to >=2.0 <2.0.9 until a compatible fix is available.

Fixes crunzphp#122

Co-authored-by: Cursor <cursoragent@cursor.com>
Adds test coverage for closure serialization including a regression test
for laravel/serializable-closure#126 where objects implementing
__serialize with nested closure properties fail to serialize on v2.0.9+.

Co-authored-by: Cursor <cursoragent@cursor.com>
"composer-runtime-api": "^2.0",
"dragonmantank/cron-expression": "^3.4.0",
"laravel/serializable-closure": "^2.0",
"laravel/serializable-closure": ">=2.0 <2.0.9",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use conflict section

/**
* @internal
*/
class TaskRunnerStub
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use anonymous classes or mocks/stubs instead

@PabloKowalczyk
Copy link
Member

Also, please target 3.9 branch

@esetnik esetnik changed the base branch from 3.10 to 3.9 February 26, 2026 17:55
@esetnik
Copy link
Author

esetnik commented Feb 26, 2026

Also, please target 3.9 branch

Done

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.

Mark as incompatible with laravel/serializable-closure v2.0.9+

2 participants