Skip to content

Commit 0096cce

Browse files
authored
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.
1 parent 042f347 commit 0096cce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/TwoFactorAuth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function getQRText($label, $secret)
272272
{
273273
return 'otpauth://totp/' . rawurlencode($label)
274274
. '?secret=' . rawurlencode($secret)
275-
. '&issuer=' . rawurlencode($this->issuer)
275+
. '&issuer=' . rawurlencode((string)$this->issuer)
276276
. '&period=' . intval($this->period)
277277
. '&algorithm=' . rawurlencode(strtoupper($this->algorithm))
278278
. '&digits=' . intval($this->digits);

0 commit comments

Comments
 (0)