Skip to content

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

Merged
PabloKowalczyk merged 3 commits into
crunzphp:3.9from
esetnik:fix/limit-serializable-closure-version
Mar 20, 2026
Merged

PabloKowalczyk merged 3 commits into
crunzphp:3.9from
esetnik:fix/limit-serializable-closure-version

Conversation

@esetnik

@esetnik esetnik commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor

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>
Comment thread composer.json Outdated
"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
Copy Markdown
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 778be38. composer.json now keeps laravel/serializable-closure at ^2.0 and blocks >=2.0.9 via the conflict section.

@PabloKowalczyk

Copy link
Copy Markdown
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

esetnik commented Feb 26, 2026

Copy link
Copy Markdown
Contributor Author

Also, please target 3.9 branch

Done

@PabloKowalczyk
PabloKowalczyk merged commit 81f8b6d into crunzphp:3.9 Mar 20, 2026
22 checks passed
@PabloKowalczyk

Copy link
Copy Markdown
Member

Thanks @esetnik

esetnik added a commit to esetnik/crunz that referenced this pull request Apr 8, 2026
The conflict added in crunzphp#123 blocked all versions >=2.0.9, but v2.0.11
includes the upstream fix (laravel/serializable-closure#129). Narrow
the constraint to >=2.0.9, <2.0.11 so only the two broken releases
(v2.0.9 and v2.0.10) are blocked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
esetnik added a commit to esetnik/crunz that referenced this pull request Apr 8, 2026
The conflict added in crunzphp#123 blocked all versions >=2.0.9, but v2.0.11
includes the upstream fix (laravel/serializable-closure#129). Narrow
the constraint to >=2.0.9, <2.0.11 so only the two broken releases
(v2.0.9 and v2.0.10) are blocked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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