Skip to content
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

[Mime] Fixed Mime\Message::ensureValidity() when a required header is set, but has an empty body #57065

Merged

Conversation

rhertogh
Copy link
Contributor

@rhertogh rhertogh commented May 22, 2024

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

According to RFC 5322 - Destination Address Fields "... Each destination field may have one or more addresses ...".
Currently Message::ensureValidity() only checks the presence of the required fields in headers which considers the message valid if the field is present but has no body. This PR adds empty checks for the required fields so that an exception will be raised when those fields are all empty.

@carsonbot
Copy link

Hey!

To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?

Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

Cheers!

Carsonbot

rhertogh added a commit to rhertogh/symfony-symfony that referenced this pull request May 22, 2024
…idity()` when a required header is set with an empty body)
@rhertogh rhertogh marked this pull request as ready for review May 22, 2024 20:03
@carsonbot carsonbot added this to the 6.4 milestone May 22, 2024
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.2 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

rhertogh added a commit to rhertogh/symfony-symfony that referenced this pull request May 23, 2024
@rhertogh
Copy link
Contributor Author

@OskarStark PR feedback has been applied

@carsonbot carsonbot changed the title Fixed Mime\Message::ensureValidity() when a required header is set, but has an empty body [Mime] Fixed Mime\Message::ensureValidity() when a required header is set, but has an empty body May 23, 2024
src/Symfony/Component/Mime/Message.php Outdated Show resolved Hide resolved
rhertogh added a commit to rhertogh/symfony-symfony that referenced this pull request May 28, 2024
@fabpot
Copy link
Member

fabpot commented May 29, 2024

Don't we have the same issue in 5.4?

@fabpot fabpot changed the base branch from 6.4 to 5.4 May 29, 2024 14:27
@fabpot fabpot force-pushed the mime_message_ensure_validity_with_empty_header branch from 864b170 to dc91a09 Compare May 29, 2024 14:27
@fabpot
Copy link
Member

fabpot commented May 29, 2024

Thank you @rhertogh.

@fabpot fabpot merged commit 9e22055 into symfony:5.4 May 29, 2024
7 of 12 checks passed
@fabpot fabpot modified the milestones: 6.4, 5.4 May 29, 2024
@xabbuh
Copy link
Member

xabbuh commented May 29, 2024

we need to rework the fix a bit for PHP 7 for Symfony 5.4 (see #57228)

fabpot added a commit that referenced this pull request May 29, 2024
This PR was merged into the 5.4 branch.

Discussion
----------

[Mime] fix PHP 7 compatibility

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | following #57065
| License       | MIT

Commits
-------

c5c6f08 fix PHP 7 compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants