-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add FILTER_FLAG_NO_SCIENTIFIC to FILTER_VALIDATE_FLOAT GH-9311 #9338
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
The feature looks reasonable, and the implementation is okay (although I'm slightly concerned regarding the flag depletion), but besides that this needs to be discussed on the internals mailing list, it is not clear whether this could target PHP-8.2 at all, although I'd consider this a small self-contained change. @ramsey, @saundefined, @adoy, thoughts about this? |
When this became a problem, flags can reuse numbers, when they are not able to be used in the same filter.
In worst case It will wait for 8.3.
@8ctopus can you contact internals mailing list with this proposition? |
@cmb69 I agree with you that this is a small change. I'm OK to include this change in 8.2 if discussion on internals don't raise any flags that I don't see. |
sorry for the slowness, I'm trying to get up and running with the mailing list subscription but without luck so far (wrote an email to the admin) |
@8ctopus I started a discussion. Can you explain what the error you got? Perhaps, we also can help you :) |
FILTER_FLAG_ALLOW_SCIENTIFIC, FILTER_FLAG_ALLOW_FRACTION and FILTER_FLAG_ALLOW_THOUSAND are only used in FILTER_SANITIZE_NUMBER_FLOAT case. Perhaps will be simpler to:
so you can use
|
@remicollet |
@KapitanOczywisty read my previous comment... about default flags and BC |
@remicollet I read your comment... That's why I'm mentioning BC. Ok, so let me show better example (more popular):
With that, above code would return Edit:
Thus |
There is no interest to merge this, so closing. |
Sorry for the time waisted :( |
This allows to validate floats, without allowing scientific format. Existing flag
FILTER_FLAG_ALLOW_SCIENTIFIC
is not used, since we don't want to change default behavior - scientific allowed.FILTER_FLAG_DISALLOW_SCIENTIFIC
was proposed, but_NO_
is more consistent with other flags and the wayfilter_var
works.Fixes: #9311
/cc @8ctopus