Fix EmailTask undefined-method errors for serialized Message settings#474
Merged
dereuromark merged 2 commits intomasterfrom Apr 17, 2026
Merged
Fix EmailTask undefined-method errors for serialized Message settings#474dereuromark merged 2 commits intomasterfrom
dereuromark merged 2 commits intomasterfrom
Conversation
Keys coming from Message::__serialize()/jsonSerialize (htmlMessage, textMessage, appCharset) don't map to set<Prop>() methods on Mailer or Message, so passing them via queued JSON payloads failed with 'Call to undefined method'. Route these keys to their real setters explicitly before the generic loop: - htmlMessage -> Message::setBodyHtml() - textMessage -> Message::setBodyText() - appCharset -> Message::setCharset() when no explicit charset is given - readReceipt -> Mailer::setReadReceipt() (address-shape, named-param safe)
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #474 +/- ##
============================================
+ Coverage 77.15% 77.22% +0.06%
- Complexity 944 949 +5
============================================
Files 45 45
Lines 3182 3196 +14
============================================
+ Hits 2455 2468 +13
- Misses 727 728 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
An associative `headers` map inside the settings array hits the same PHP 8 named-parameter problem as the address maps: string keys would otherwise be interpreted as named arguments when the generic loop spreads them into `setHeaders()`. Forward the map as a single positional argument instead.
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
Fixes #473.
Building on #472, this tackles pre-existing bugs in the same code path that were shadowed by the named-parameter crash. Once address settings stopped throwing first, the generic settings loop started calling undefined methods and re-hitting the named-param issue on non-address keys:
Fix
Before the generic settings loop, handle the mismatched/unsafe keys explicitly:
htmlMessageMessage::setBodyHtml()textMessageMessage::setBodyText()appCharsetMessage::setCharset()when no explicitcharsetis also provided (appCharset has no dedicated setter anywhere)readReceiptemail => nameinputs work without PHP 8 named-parameter issuesheadersMessage::setHeaders()called with the map as a single positional argument, so string header names are not interpreted as named parametersThe generic
call_user_func_arrayfallback is kept, so any customset*keys consumers currently rely on continue to work unchanged.Covered all 20 entries in
Message::$serializableProperties:Regression tests cover a payload that mirrors
Message::__serialize()output and a settings-level associativeheadersmap.