New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy loaded Swift_Message can cause unserialize errors when using file spool #117
Comments
How about adding option to disable lazy loading here? |
Do you want to send a PR for it? I don't see a problem with making it optional, although it would be nicer if it was fixed upstream.. I find it strange that such classes end up in the spool. I would think the lazy loading is just delaying the creation until we use the message, but once it is sent to Swift it should really store it in a way that can be reloaded not based on the cache settings :/ |
OK, I'll try. |
@Seldaek wrote:
Yes, for this purpose a proxy class with a random name is created instead of Swift_Message class. I think this is not an upstream problem but a reasonable solution. To keep Swift_Message lazy its descendant in MonologBundle can be created with custom serialization method. Method can check for VirtualProxyInterface on $this and return serialization of the real message object, not his proxy. It's quite cumbersome but how about this? |
PR to add "lazy" option: #132 |
I can merge your PR as a workaround but I think the proxy class created by symfony should handle serialization gracefully (i.e. instantiate itself fully at that point and then serialize the instance). Or did I misunderstand you? Still sounds like something that could be fixed in symfony. |
@Seldaek the problem is that so the class must exist again to deserialize. The only way to change that would be to change the calling code to stop using PHP serialization |
#117: Add option to control swift_mailer lazy loading.
Oh right that sucks. I merged the workaround PR then. I guess it should be in the docs that if not using the memory spool people should disable lazy logging as well? Or did I misunderstand that? cc @RyanWeaver |
I doubt @RyanWeaver has anything to say here. :) /cc @weaverryan |
I'm going to close this issue as we can not dot anything here. Thanks |
When storing message in file it will be serialized with class name like
Swift_Message_000000003b027a18000000005cb90b1f
. After container rebuild this name will change. So if cache was cleared after message stored but beforeswiftmailer:spool:send
command executed there will be errorCatchable Fatal Error: Argument 1 passed to Swift_Transport_MailTransport::send() must implement interface Swift_Mime_Message, instance of __PHP_Incomplete_Class given
.This is a rare but troublesome case.
The text was updated successfully, but these errors were encountered: