This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests
Fabien Potencier 165b08986b merged branch mrtorrent/use_parse_error_code_in_stubnumberformatter (PR #2521)
Commits
-------

89cd64a Set error code when number cannot be parsed. Fixes #2389

Discussion
----------

Set error code when number cannot be parsed in StubNumberFormatter

The stub implementation of NumberFormatter never sets an error code and instead always returns the "no-error" code. This causes unexpected results when a transformer gives it bad arguments, such as transforming the input value to boolean false and causing exceptions further down the line, as in #2389.

Instead, it should set an error code when appropriate and return it when requested so that a TransformationFailedException can be raised and the input value left unaltered.

There may be other instances where an error should be set. This covers the common use case of non-numeric input.

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2389
2011-11-02 14:36:52 +01:00
..
Symfony/Tests merged branch mrtorrent/use_parse_error_code_in_stubnumberformatter (PR #2521) 2011-11-02 14:36:52 +01:00
bootstrap.php replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00