Skip to content

[Mime] Allow url as a path in the DataPart::fromPath #46548

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

Merged
merged 1 commit into from
Jun 9, 2022

Conversation

wkania
Copy link
Contributor

@wkania wkania commented Jun 1, 2022

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

While switching from the Swift Mailer to the Symfony Mailer I encounter a bug Symfony\Component\Mime\Exception\InvalidArgumentException.
Steps to reproduce:

  1. I have created an email with an attachment that is a remote file and saw An exception has been thrown during the rendering of a template.
  2. Also when I have visited tab E-mails in the Symfony Profiler, saw the same Symfony Exception page

DataPart can't be created from url, even if fopen can open url.
Apparently, before Symfony 4.4.11 this worked with URLs. At least in the context of email with attachments.
PHP doesn't support rewind on non-local streams, so calling multiple times method getBody from TextPart would return an empty string. So in another context, it worked partially.

Additional notes:

  1. Network example based on this
  2. Base64Encoder chunk split base64 encoded string so I only check the first line

@nicolas-grekas
Copy link
Member

Thank you @wkania.

@nicolas-grekas nicolas-grekas merged commit 2cae93a into symfony:4.4 Jun 9, 2022
@fabpot fabpot mentioned this pull request Jun 9, 2022
This was referenced Jun 26, 2022
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.

3 participants