Fix v2.0.9 regression: Bus::chain breaks with nested closures#2
Closed
JoshSalway wants to merge 1 commit into2.xfrom
Closed
Fix v2.0.9 regression: Bus::chain breaks with nested closures#2JoshSalway wants to merge 1 commit into2.xfrom
JoshSalway wants to merge 1 commit into2.xfrom
Conversation
…ialize The v2.0.9 change to skip objects with __serialize was too broad - it prevented nested closures (e.g. in array properties) from being wrapped, causing "Serialization of 'Closure' is not allowed" errors in patterns like Bus::chain with closures inside Bus::batch. Instead of skipping the entire object, skip only Closure-typed properties (which the object's __serialize handles) while still recursing into other properties to wrap nested closures. Fixes laravel#126 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
Author
|
Moved upstream → laravel#129 |
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.
Summary
__serializeinwrapClosures/mapByReferencewas too broadBus::chainitems insideBus::batch) were no longer wrapped, causing "Serialization of 'Closure' is not allowed" errorsClosure-typed properties (which__serializehandles) while recursing into other propertiesNote: This is a different fix from PR #1 (method-only attributes). This addresses issue laravel#126 specifically.
Fixes laravel#126
Test plan
SerializeNestedClosureRegressionTest)Bus::chain([fn() => ...])insideBus::batch()serialization__serializeand Closure-typed properties still serialize correctly🤖 Generated with Claude Code