-
Notifications
You must be signed in to change notification settings - Fork 348
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
Allow float sizes for 32bit support #1444
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1444 +/- ##
=========================================
Coverage 97.33% 97.33%
Complexity 2830 2830
=========================================
Files 176 176
Lines 9419 9419
=========================================
Hits 9168 9168
Misses 251 251 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
When a file size gets bigger than PHP_INT_MAX (e.g. about 2GB on 32-bit systems) then the And so as the file size gets bigger, it gradually becomes more granular. Something roughly like:
And so How is that likely to impact on clients that want to:
|
@come-nc do you also want/need to expand the return type of implementations such as or do you just need |
may I ask about the use-case? I guess you need this more precise return type for static analysis tools or similar? |
I do not know the details on that, I only know what happens on PHP side of typing, sorry.
This is already the case, getSize is returning a float for these files on 32bits, it’s just that static analysis believe it’s an int because of the docblock.
For Nextcloud we only use
Yes. This change allow static analysis tools such as psalm to warn us about places where we are making the assumption that size is an int and that will break on 32bit installations. Then we can either fix this code to support float or add a check and error out when it’s a float and document a known limitation on 32bit. For Nextcloud sizes are mostly used for quota checks and storage space use estimation, so sizes being a few bit off on huge files should not be a problem. And is better than a crash anyway. |
one thing I can think of where this might get problematic would be e.g. a but I guess these cases would get obvious when we have this more precise return type, right? |
Not sure, the typing will tell you it’s a float but not that it’s imprecise. It all depends on how you are building the header I suppose. |
For 32bit support in Nextcloud we are typing sizes as int|float as PHP uses float for bigint.
Would you consider merging this change?