This fixes a bug in \SwedbankPaymentPortal\Transaction\TransactionRepository::__construct() where check against the type of $dir parameter will never catch NULL value and will always switch to default case which throws an exception.
switch (true) {
case is_string($dir):
case null: // <- This case will never trigger.
$this->fileCache = new FilesystemCache($dir ? $dir : sys_get_temp_dir() . '/banklink');
break;
default:
throw new \RuntimeException(
"`dir` parameter must be a string or an object which implements Cache interface"
);
}
The solution is to check for null type and go from there.
switch (true) {
case is_string($dir):
case is_null($dir):
// ...
This bug breaks backwards compatibility as implementations that don't use custom cache cease to work:
RuntimeException: dir parameter must be a string or an object which implements Cache interface in SwedbankPaymentPortal\Transaction\TransactionRepository->__construct() (line 56 of /var/www/[snip]/vendor/swedbank-spp/swedbank-payment-portal/src/Transaction/TransactionRepository.php).
This fixes a bug in
\SwedbankPaymentPortal\Transaction\TransactionRepository::__construct()
where check against the type of$dir
parameter will never catchNULL
value and will always switch todefault
case which throws an exception.The solution is to check for
null
type and go from there.This bug breaks backwards compatibility as implementations that don't use custom cache cease to work: