User tests: Successful: Unsuccessful:
The float and double filter changes the value to an integer if there is no number prior to the decimal.
.0125 => 125
0.0125 => 0.0125
Modified the RegExp to look for a leading decimal.
Create a form with a float/double filtered text field, and pass a decimal value without a leading number.
Example: .0125
The value should remain a decimal like one of the following:
.0125
0.0125
The value gets converted to a whole number by removing the decimal and leading zeros.
Example: .0125 becomes 125
Status | New | ⇒ | Pending |
Category | ⇒ | External Library Libraries |
In the last times we did not as this is a external lib maintained outside of the core :-)
Title |
|
let's ping @HLeithner then
we have the same issue for example in mod_popular_tags (with or without this patch)
<field
name="minsize"
type="number"
label="MOD_TAGS_POPULAR_FIELD_MINSIZE_LABEL"
description="MOD_TAGS_POPULAR_FIELD_MINSIZE_DESC"
default="1"
filter="float"
/>
for me a fix should be done here https://github.com/joomla/joomla-cms/blob/staging/libraries/src/Filter/InputFilter.php#L196
changing
$pattern = '/[-+]?[0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?/';
with
$pattern = '/^(?!-0?(\.0+)?(e|$))-?(0|[1-9]\d*)?(\.\d+)?(?<=\d)(e-?(0|[1-9]\d*))?$/';
but i'm not a regex expert my font of truth is https://stackoverflow.com/questions/2811031/decimal-or-numeric-values-in-regular-expression-validation
here is a list of test case
Aceppting float without leading zero seams wrong to me.
ok then simply close it
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-05-12 07:28:54 |
Closed_By | ⇒ | franz-wohlkoenig | |
Labels |
Removed:
J3 Issue
|
@wilsonge this is a PR against a FoF file - are we accepting those here?