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 field is backed by PHP's $_FILES['fileupload']['size'] field, which is not provided by the client, it's computed on the server-side from the number of bytes written to disk for the temp file containing the uploaded content. See here: https://github.com/php/php-src/blob/c8aa6f3a9a3d2c114d0c5e0c9fdd0a465dbb54a5/main/rfc1867.c (I wish I could point you to a more specific line, but it's computed all over the place; track how total_bytes is computed and that it's later used for ['size']).
Symfony shouldn't tell people that the size field is unreliable, as that technically would make it useless for any size checks. Instead it's a trusted value, as far as the built-in $_FILES implementation is concerned.
The text was updated successfully, but these errors were encountered:
…me for UploadedFile::getClientSize() (Simperfit)
This PR was merged into the 4.1-dev branch.
Discussion
----------
[HttpFoundation] Incorrect documentation and method name for UploadedFile::getClientSize()
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | no
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | yes <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | #23791
| License | MIT
| Doc PR | none
Replace the wrong named and documented method by another with better doc and better naming
Commits
-------
b136320 [HttpFoundation] Incorrect documentation and method name for UploadedFile::getClientSize()
The API for accessing file-size of Http Foundation's UploadedFile is named and documented incorrectly:
https://github.com/symfony/http-foundation/blob/9723780247b0c207f4937e8f31163a0c2d7231f5/File/UploadedFile.php#L172
This field is backed by PHP's $_FILES['fileupload']['size'] field, which is not provided by the client, it's computed on the server-side from the number of bytes written to disk for the temp file containing the uploaded content. See here: https://github.com/php/php-src/blob/c8aa6f3a9a3d2c114d0c5e0c9fdd0a465dbb54a5/main/rfc1867.c (I wish I could point you to a more specific line, but it's computed all over the place; track how total_bytes is computed and that it's later used for ['size']).
Symfony shouldn't tell people that the size field is unreliable, as that technically would make it useless for any size checks. Instead it's a trusted value, as far as the built-in $_FILES implementation is concerned.
The text was updated successfully, but these errors were encountered: