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.
This commit is contained in:
Roland Eigelsreiter
2021-11-29 06:50:54 +01:00
committed by GitHub
parent 042f347666
commit 0096cce02d
+1 -1
View File
@@ -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);