-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
refactor: Breaking: Differentiate between kilobyte/kibibyte and megabyte/mebibyte #9271
Conversation
BC changes are directed to 4.6. The calculation method is made too simple. The designations must have an exact register: |
@ThomasMeschke While I agree with your arguments, I would like to hear from other maintainers about how we should handle this because we have a similar problem in the
The first solution would introduce a BC break, but it would also straighten things out. The second would tell developers how calculations work, but would still retain confusing symbols - at least for more technical folks... from an end-user perspective, I don't think they would care. |
While I absolutely see the "no normal user would differentiate between kb and KB" argument, I would say most people using and integrating with CodeIgniter at least have a basic understanding of computer science and should (and most probably will) know the difference, which is why I think the "do it right instead of commenting to explain the wrong" way. If we do however I would prefer the "KiB" way over the "KB" way to make it more clear, because upper and lower casing as the only difference would leave it more confusing in my opinion. |
I guess this mostly usage for academic purpose, and only for niche usage in real application. It still a breaking change, and can't land to develop imo. |
I made a new PR to the right branch: This one can get closed. |
The way I noticed this is while implementing a file upload with a file size limitation, that did not match frontend to backend, because the frontend used 1000 (also in a wrong way, but that's a different story) and the CI-Backend used 1024. Option would have been to copy the getSizeByUnit into my own Code, change the numbers to 1000 and call this instead, but this felt quite hacky. =D |
Closed, thanks! |
Description
Noticed that the file size calculation mixes up the SI unit prefixes with the NIST/IEC unit prefixes, by taking "kb" and "mb" but calculating "kib" and "mib".
Fixed by providing both possibilities.
This therefore will break existing code!
Checklist: