Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] prevent duplicated error message for file upload limits#39119
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
xabbuh commentedNov 19, 2020
| Q | A |
|---|---|
| Branch? | 4.4 |
| Bug fix? | yes |
| New feature? | no |
| Deprecations? | no |
| Tickets | Fix#32045,#36503,#39107 |
| License | MIT |
| Doc PR |
thewalkingcoder commentedNov 20, 2020
xabbuh commentedNov 20, 2020
Thank you for the feedback. Could you create a small example application that allows me to reproduce and debug the issue? |
thewalkingcoder commentedNov 20, 2020
@xabbuh ok i try to create that today. |
thewalkingcoder commentedNov 20, 2020
@xabbuh |
| // Only add the error if the form is synchronized | ||
| if ($this->acceptsErrors($scope)) { | ||
| if (File::TOO_LARGE_ERROR ===$violation->getCode()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
a better check could be$violation->getCause() instanceof File to account for the different error codes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think so. If there are multiple file upload files and one of them fails with another check of theFile constraint we could potentially remove an error here that we would have to keep.
xabbuh commentedNov 20, 2020
Status: Needs work |
xabbuh commentedNov 21, 2020
@thewalkingcoder Thanks, based on your example I was able to find a few issue with my initial solution. Can you try the updated patch again? |
xabbuh commentedNov 21, 2020
Status: Needs Review |
thewalkingcoder commentedNov 21, 2020
@xabbuh thanks for your works. Your commit resolve the duplicated message and so resolve#39107 but if i remove /** * @var array<UploadedFile> * @Assert\NotBlank(message="Veuillez sélectionner un fichier.") * @Assert\All({ * @Assert\File( * maxSize = "500k", * maxSizeMessage = "Custom message max size.", * uploadFormSizeErrorMessage = "Custom message max size form", * ) * }) */public$files; error message is normally is
other issue ? or side effect with the PR ? |
xabbuh commentedNov 21, 2020
If I understand you correctly, that's expected. The file couldn't be uploaded as the maximum file limit configured for PHP is reached and thus the |
thewalkingcoder commentedNov 21, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@xabbuh i say just i don't understand the behaviour
for me this PR resolve duplicated error Message. but if i remove Assert uploadIniSizeErrorMessage
default message maxSize is applied instead MaxSizeMessage For me, the expected behaviour is
I'm not sure is a side effect with this PR |
xabbuh commentedNov 22, 2020
Well, if the file exceeds the limit configured with |
fabpot commentedNov 27, 2020
Thank you@xabbuh. |
COil commentedDec 5, 2020
Hi, I can confirm it is fixed in 5.1.9. Thank you. |


