Skip to content

Commit 32d1074

Browse files
authored
Merge pull request #8250 from cakephp/docs-parsefloat-null
Document Number::parseFloat() returning null on failure
2 parents 27cfdc9 + 3a11e50 commit 32d1074

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

docs/en/appendices/5-4-migration-guide.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ bin/cake upgrade rector --rules cakephp54 <path/to/app/src>
1616

1717
## Behavior Changes
1818

19-
- WIP
19+
### I18n
20+
21+
``Number::parseFloat()`` now returns ``null`` instead of ``0.0`` when parsing
22+
fails. Previously, when ``NumberFormatter::parse()`` failed it returned ``false``,
23+
which was cast to ``0.0``. This silently converted invalid input like ``"abc"``
24+
to ``0.0``, making it impossible to distinguish from valid ``"0"`` input.
25+
26+
This also affects ``FloatType`` and ``DecimalType`` database types which use
27+
``Number::parseFloat()`` internally. Invalid locale-formatted form input will
28+
now result in ``null`` entity values instead of ``0``.
2029

2130
## Deprecations
2231

0 commit comments

Comments
 (0)