Closed (outdated)
Project:
Currency
Version:
8.x-3.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
23 Feb 2026 at 09:35 UTC
Updated:
23 Feb 2026 at 16:36 UTC
Jump to comment: Most recent
Problem
When the decorated exchange rate provider (e.g. FixedRates) returns NULL for a currency pair that has no configured rate, ExchangeRateProviderDecorator::load() and loadMultiple() pass that NULL directly to ExchangeRate::createFromExchangeRate(), which expects ExchangeRateInterface. This causes a TypeError.
Error message
Drupal\currency\ExchangeRate::createFromExchangeRate(): Argument #1 ($other_exchange_rate) must be of type Commercie\CurrencyExchange\ExchangeRateInterface, null given, called in .../ExchangeRateProviderDecorator.php on line 44
Steps to reproduce
createFromExchangeRate(null, ...).Proposed solution
Add null checks in load() and loadMultiple() before calling ExchangeRate::createFromExchangeRate(). If the decorated provider returns NULL, return NULL from load() or skip the entry in loadMultiple().
Patch
Attached patch adds the null checks to both methods.
Comments
Comment #2
ivan shatalov commented