You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR was merged into the 6.4 branch.
Discussion
----------
[Mime] Fix TextPart using an unknown File
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Issues | Fix#57258 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License | MIT
Commits
-------
a6c8963 [Mime] Fix TextPart using an unknown File
Symfony version(s) affected
All current versions
Description
When using DataPartFile with a wrong path (file does not exists) and then calling
->getBody()
it returns an empty string instead of an error.How to reproduce
(new DataPartFile('/some/wrong/path/to/file.md'))->getBody() === ''; // true
.Possible Solution
It is because Symfony does not use strict types. When calling
file_get_contents
in this code :It automatically converts the
false
to''
.Maybe wirth checking if false then throw
throw new InvalidArgumentException(sprintf('Path "%s" is not readable.', $path));
like in__construct
.Additional Context
No response
The text was updated successfully, but these errors were encountered: