Issue #3375447: FileUploadHandler::handleFileUpload() assumes an UploadedFile object
Merge request reports
Activity
added 82 commits
-
b3e943e9...e646c8e5 - 82 commits from branch
project:11.x
-
b3e943e9...e646c8e5 - 82 commits from branch
added 1 commit
- b3efa9dc - Replace exception with violations for entity validate too
added 98 commits
-
b3efa9dc...72e7c019 - 92 commits from branch
project:11.x
- cae66659 - Use uploaded file validator
- 0904ba7f - Fix test fails
- 795bc379 - Improve how we test maxSize
- 27ff03dd - Add deprecations for interface methods
- aaa969d4 - Swap exceptions with violations
- c2db92f5 - Replace exception with violations for entity validate too
Toggle commit list-
b3efa9dc...72e7c019 - 92 commits from branch
added 143 commits
-
c2db92f5...e3e45ab3 - 135 commits from branch
project:11.x
- 755e2a1c - Use uploaded file validator
- eda4028d - Fix test fails
- 53ecbd7f - Improve how we test maxSize
- 7bf6259e - Add deprecations for interface methods
- 9d44346f - Swap exceptions with violations
- b3efa9dc - Replace exception with violations for entity validate too
- 61283421 - Merge branch '11.x' into 3375447-uploadedfile-constraint
- dd781d86 - Merge branch '3375447-uploadedfile-constraint' of...
Toggle commit list-
c2db92f5...e3e45ab3 - 135 commits from branch
- Resolved by Kim Pepper
- Resolved by Kim Pepper
- Resolved by Kim Pepper
- Resolved by Kim Pepper
- Resolved by Kim Pepper
Looks good, I think there's one BC concern we're missing here.
Previously ::handleFileUpload used exceptions to control flow in the invalid cases, but now it does not (by design).
However, calling code might be relying on those exceptions to check if the result is valid, and as such won't know it needs to call $result->getViolations()> 0 (or a new ::isValid as discussed above).
I think we need an additional parameter to ::handleFileUpload that is
bool $throw
which defaults to TRUE. In new code we can pass FALSE.In old code, it will get the default of TRUE.
If
$throw
is TRUE, we should check the violation list and throw an Exception if the file isn't valid.Additionally, when
$throw
is true we can also calltrigger_error
to trigger a deprecation error to communicate that the calling code needs to update to use ::isValid or similar.
added 6 commits
-
f5ba86c3...22576037 - 5 commits from branch
project:11.x
- 8dd36b27 - Merge branch '11.x' into 3375447-uploadedfile-constraint
-
f5ba86c3...22576037 - 5 commits from branch
added 1 commit
- c55757d9 - Add deprecation triggers and bc support for throws
added 1 commit
- 38ef43d4 - Change signature of validate to only take options