-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
message cloning and headers #28
Comments
ps. I'm on php72 and am using 2.10.0 of zend-mail (2.9 also had this) Originally posted by @basz at zendframework/zend-mail#214 (comment) |
i've added in my project wrapper which implements __clone: https://github.com/eventum/eventum/blob/v3.5.1/src/Mail/MailMessage.php#L651-L659 however it still doesn't work, so more deeper probably need deeper clone in however, doing it properly would mean add Originally posted by @glensc at zendframework/zend-mail#214 (comment) |
I am under the impression that if you do not specify a __clone method a deep clone was performed by default? Originally posted by @basz at zendframework/zend-mail#214 (comment) |
rather opposite: http://php.net/manual/en/language.oop5.cloning.php
and as objects are always references in php5+, the result is that cloned subobjects remain shared. Originally posted by @glensc at zendframework/zend-mail#214 (comment) |
I have a service that has an injected default message. It has some default fields, such as encoding, from_name, from which are equal for any mail sent.
Internally it will create a clone from the default message and then it will add the actual rendered content, to subject. etc. It also adds Content-Type and an X-Header.
However at some point I noticed messages were having duplicate Content-Type and X-Header headers and some servers will deny those messages. Every time a message is sent and additional header is added. (this is a long running process)
Code to reproduce the issue
Expected results
Headers should be unique due to the clone of the default message
Actual results
I'm aware normally one should create a new Message for each Message you attempt to sent. I have changed my code to do this, but I still think this should simply work. I'm wondering why clone doesn't really clone...
Originally posted by @basz at zendframework/zend-mail#214
The text was updated successfully, but these errors were encountered: