From 0096cce02d2f4a627a85c618b8010b01add6a681 Mon Sep 17 00:00:00 2001 From: Roland Eigelsreiter Date: Mon, 29 Nov 2021 06:50:54 +0100 Subject: [PATCH] convert issuer to string prevents php 8.1 errors By forcing $this->issuer to be string, even if null is set, it prevents throwing errors in PHP 8.1 is `rawurlencode` is not allowed to have null as parameter. It would be better to force string to be already in `__construct`, but this may create a breaking change for existing users. --- lib/TwoFactorAuth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/TwoFactorAuth.php b/lib/TwoFactorAuth.php index c46ac17..c94f806 100644 --- a/lib/TwoFactorAuth.php +++ b/lib/TwoFactorAuth.php @@ -272,7 +272,7 @@ class TwoFactorAuth { return 'otpauth://totp/' . rawurlencode($label) . '?secret=' . rawurlencode($secret) - . '&issuer=' . rawurlencode($this->issuer) + . '&issuer=' . rawurlencode((string)$this->issuer) . '&period=' . intval($this->period) . '&algorithm=' . rawurlencode(strtoupper($this->algorithm)) . '&digits=' . intval($this->digits);