-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Added support for validation of giga values #32485
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
Conversation
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.
Can you please add a test?
@@ -104,6 +104,8 @@ private function normalizeBinaryFormat($maxSize) | |||
'ki' => 1 << 10, | |||
'm' => 1000000, | |||
'mi' => 1 << 20, | |||
'g' => 1000000000, |
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'd rather use constant expression as it is easier to see that the value is correct
'g' => 1000000000, | |
'g' => 1000 * 1000 * 1000, |
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.
Great idea. Could you add the change for 'm' as well?
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.
as this is a bugfix it's advisable to leave it for the next commit
if you want to change it (i certainly like code consistency) this is the line:
'm' => 1000 * 1000,
@derrabus ok, i'll try to setup a testing environment for it but it will take a few days, probably. |
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.
as is is consistent
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.
Tests fail, please have a look at them :)
@nicolas-grekas |
Thank you @kernig. |
…ernig) This PR was squashed before being merged into the 3.4 branch (closes #32485). Discussion ---------- [Validator] Added support for validation of giga values As described in issue #32479 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | just tested on my presta and it works. if further tests are necessary, it would be great if someone could help! | Fixed tickets | #32479 | License | MIT | Doc PR | The validation(function normalizeBinaryFormat) in symfony/src/Symfony/Component/Validator/Constraints/File.php doesn't work with gigabyte values in php.ini. In the PHP documentation it says "PHP allows shortcuts for byte values, including K (kilo), M (mega) and G (giga). " so in my opinion these values should work. Thanks to @kijamve for the fix. Commits ------- 969f2c4 [Validator] Added support for validation of giga values
As described in issue #32479
The validation(function normalizeBinaryFormat) in symfony/src/Symfony/Component/Validator/Constraints/File.php doesn't work with gigabyte values in php.ini.
In the PHP documentation it says "PHP allows shortcuts for byte values, including K (kilo), M (mega) and G (giga). " so in my opinion these values should work.
Thanks to @kijamve for the fix.