https://github.com/thibaut-decherit/nested-file-entity-bug
https://github.com/thibaut-decherit/nested-file-entity-bug
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/thibaut-decherit/nested-file-entity-bug
- Owner: thibaut-decherit
- Created: 2020-04-20T09:28:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-20T13:04:45.000Z (over 5 years ago)
- Last Synced: 2025-01-22T11:49:51.584Z (11 months ago)
- Language: PHP
- Size: 94.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nested file entity size validation bug
## Steps to reproduce
Make sure you have `upload_max_filesize = 2M` in your `php.ini`.
Go to `localhost:8000/new` and submit an image larger than 2Mo.
Two errors should appear instead of one.
## Assumption
It's like the file size is validated prior to `@Assert\Image()` in `src/Entity/Logo.php` (maybe by the form itself or
indirectly through a caught exception?) then a second time by `@Assert\Image()`, this time properly overwritten by
`maxSize="2M"` (note the `[...] size is 2 MB` instead of `[...] size is 2 MiB`):

Note that if you remove `@Assert\Valid()` from `src/Entity/Company.php` only the first error is thrown:

(but `@Assert\Image()` is ignored so it is not a solution, you can confirm this by trying to submit a file other than
jpeg, you will not get an error)