Problem/Motivation

Putting an incorrect float value results with an error that will erase all the previous values in the DB.

Steps to reproduce

1. Visit /admin/commerce/config/exchange-rates
2. Create an entity with plugin: 'Manual' and set up some non-zero currency rates values, then save the entity
3. Edit the newly created entity
4. Put an incorrect float for one of the rates values (e.g. use comma as a delimiter: '0,1' or just put an empty string)
5. Save the entity and you'll see the WSOD
6. Also check the db, all the previous values will be zeroed out

Proposed resolution

Implement a ExchangeRatesForm:validateForm() method that will check if the values are actually valid float values

CommentFileSizeAuthor
#5 Screencast From 2025-09-01 22-10-34.gif280.09 KBvalic
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

juliusz_cheddar created an issue. See original summary.

juliusz_cheddar’s picture

Status: Active » Needs review

valic made their first commit to this issue’s fork.

valic’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new280.09 KB

Tnx.

I did update as well validation on \Drupal\commerce_exchanger\ExchangerManager::setLatest if someone is doing direct updates, that we adhere to some structure with `.` as delimiter.

And in addition added states logic on form, that manual value can be entered without needed to check it first, than save, than edit

Form states

valic’s picture

Status: Reviewed & tested by the community » Fixed

Tnx

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.