Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think casting to would be a better alternative for this since there's no for the function call (we also don't need to perform any kind of base conversion).
I'm just afraid, though, that this hides the problem instead. The main question here is: how come these aren't integers?
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.
Casting is fine. The underlying "problem" is that PHP returns the filesize as a string in the $_FILES global:
I now see that the error is actually an integer so only the size must be cast to integer. I'll change that.
Now, why the size is a string is not clear to me but it might have something to do with this bugfix from the past: https://bugs.php.net/bug.php?id=45124.
A 2GB file would be 2,147,483,648 bytes and max int (32 bit) would be 2,147,483,647. So it's possible they changed the size into a string because of that. This would be no problem with a 64 bit integer so I don't think it will be a problem just casting the string to an integer.