8000 Incorrect documentation and method name for UploadedFile::getClientSize() · Issue #23791 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Incorrect documentation and method name for UploadedFile::getClientSize() #23791

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stanvass opened this issue Aug 4, 2017 · 0 comments
Closed

Comments

@stanvass
Copy link
stanvass commented Aug 4, 2017
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version all

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.

fabpot added a commit that referenced this issue Dec 11, 2017
…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()
@fabpot fabpot closed this as completed Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0