Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Message::getSender creates a blank Sender header #93

Merged

Conversation

MichaelGooden
Copy link
Contributor

The getSender() method of Message unintentionally creates a blank Sender header.

The expected behaviour is to return null if the Sender header does not exist however the current implementation creates a blank Sender header in the process. Subsequent calls to getSender will return a blank header instead of the null that is expected.

This directly affects Transport\Smtp as getSender is used in the sending logic. Therefore, this PR has a test against Smtp as well as against Message. This might be redundant. It does however test expected Smtp functionality, so comments on that tests inclusion in the final patch are welcome.

RFC5322 section 3.6.2 states that if the originator of the message can be
indicated by a single mailbox and the author and transmitter are identical,
the "Sender:" field SHOULD NOT be used.
Message::getSender() unintentionally creates an empty Sender header.
@MichaelGooden
Copy link
Contributor Author

Bump?

@weierophinney

@MichaelGooden
Copy link
Contributor Author

@Ocramius Any chance you can review this? It seems to have gotten lost in the background noise.

@@ -314,6 +314,10 @@ public function setSender($emailOrAddress, $name = null)
*/
public function getSender()
{
$headers = $this->getHeaders();
Copy link
Member

Choose a reason for hiding this comment

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

This change seems unrelated: what call did cause the header to be added? You are only fixing the symptom here, IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Calling Message::getHeaderByName will create a new blank header if the requested header does not exist, as per the docbloc.

The existing strategy as per Message::getSubject is to check if the header exists before calling getHeaderByName. (The existing code also uses a local variable for $headers.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Ocramius Could you review please?

Copy link
Member

Choose a reason for hiding this comment

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

LGTM 👍

@MichaelGooden
Copy link
Contributor Author

MichaelGooden commented Feb 13, 2017

EDIT: This comment was completely insensitive and wrong, please see my response below. Leaving the original message here for historical purposes.

@weierophinney @Ocramius @akrabat @Bittarman @EvanDotPro @ezimuel @Maks3w @Freeaqingme Does no one care about bugs in Zend Framework anymore? This is a well defined, tested and audited bugfix that has been ignored for over 6 months. I have done all the work, all that is needed is 20 seconds of confirmation and a merge. I don't know what more I can do.

@Ocramius
Copy link
Member

Ocramius commented Feb 13, 2017 via email

@GeeH
Copy link
Contributor

GeeH commented Feb 13, 2017

You think that people don't care because they haven't had time to merge your specific bug? I'm saddened by the level of entitlement in open source at the moment. I honestly appreciate the effort you've put into this fix, but if you think that merging this is a 20-second job you are sadly mistaken.

The community review team are now supporting 131 repositories according to GitHub, which is an extraordinary amount of work for such a small team, and the number of paid contributors is exactly two.

I've pinged @weierophinney internally to ask him to merge this, but please, when responding to other open source maintainers, please practice empathy. If you think you can do a better job or would like to volunteer to be a maintainer of this repository then please step up and email Matthew - at this point, all your comments are doing is alienating people and making them frustrated and angry.

Gary.

@MichaelGooden
Copy link
Contributor Author

@Ocramius, @GeeH, and others: I am massively, entirely sorry for the comment I left on this issue.

I am not going to make any excuses because what I said was just plain wrong. I am hugely grateful and appreciative towards all the contributors for creating the tools that allow me to eek out a livelihood for myself.

I hope you can accept my apologies and believe me when I say I had no intention of offending anyone or acting entitled.

Michael

@Ocramius
Copy link
Member

@MichaelGooden 🍻 alright! Sorry for the over-reaction, probably a bad day for me as well (had another few of these reactions lately, so I'm a bit jittery when they come up)

@GeeH
Copy link
Contributor

GeeH commented Feb 14, 2017

Indeed, I don't think you need to apologise @MichaelGooden - I was just wanting to make a point. However apologising definitely makes you the better person 😄 .

🍺

@weierophinney weierophinney added this to the 2.7.3 milestone Feb 14, 2017
@weierophinney weierophinney self-assigned this Feb 14, 2017
@weierophinney weierophinney merged commit a6e9193 into zendframework:master Feb 14, 2017
weierophinney added a commit that referenced this pull request Feb 14, 2017
Message::getSender creates a blank Sender header
weierophinney added a commit that referenced this pull request Feb 14, 2017
weierophinney added a commit that referenced this pull request Feb 14, 2017
weierophinney added a commit that referenced this pull request Feb 14, 2017
@weierophinney
Copy link
Member

Thanks, @MichaelGooden

@eth8505 eth8505 mentioned this pull request Feb 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants