Skip to content

Commit

Permalink
fix exception thrown when a user is low on printable codes
Browse files Browse the repository at this point in the history
This error was shown in the browser:
```
SimpleSAML\Error\Error: UNHANDLEDEXCEPTION

Backtrace:
1 www/_include.php:20 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: TypeError: str_replace(): Argument #2 ($replace) must be of type array|string, int given
Backtrace:
7 lib/SimpleSAML/Locale/Translate.php:308 (str_replace)
6 lib/SimpleSAML/Locale/Translate.php:308 (SimpleSAML\Locale\Translate::t)
5 lib/SimpleSAML/XHTML/Template.php:914 (SimpleSAML\XHTML\Template::t)
4 modules/material/themes/material/mfa/low-on-backup-codes.php:32 (require)
3 lib/SimpleSAML/XHTML/Template.php:560 (SimpleSAML\XHTML\Template::show)
2 modules/mfa/www/low-on-backup-codes.php:35 (require)
1 lib/SimpleSAML/Module.php:266 (SimpleSAML\Module::process)
0 www/module.php:10 (N/A)
```
  • Loading branch information
briskt committed May 24, 2024
1 parent 9ae69c4 commit e3730cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/mfa/lib/Auth/Process/Mfa.php
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ protected static function redirectToLowOnBackupCodesNag(
$numBackupCodesRemaining
) {
$state['employeeId'] = $employeeId;
$state['numBackupCodesRemaining'] = $numBackupCodesRemaining;
$state['numBackupCodesRemaining'] = (string)$numBackupCodesRemaining;

$stateId = State::saveState($state, self::STAGE_SENT_TO_LOW_ON_BACKUP_CODES_NAG);
$url = Module::getModuleURL('mfa/low-on-backup-codes.php');
Expand Down

0 comments on commit e3730cc

Please sign in to comment.