PHPGangsta / GoogleAuthenticator

PHP class to generate and verify Google Authenticator 2-factor authentication

Home Page:http://phpgangsta.de/4376

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP 8.2 issue with `${var}` declarations

scottchiefbaker opened this issue · comments

FYI:

PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/html/scott/rats/GoogleAuthenticator/PHPGangsta/GoogleAuthenticator.php on line 112

Super easy fix.

English (machine translation):
I'm also experiencing this issue, but judging by the activity, it shouldn't be maintained anymore, so I'll have to deal with it on my own.
The way I handled it is as follows, hopefully it can be a reference for people encountering the same problem:

Comment out line 112 and replace it with the following:

        return sprintf('https://api.qrserver.com/v1/create-qr-code/?data=%s&size=%dx%d&ecc=%s',
            $urlencoded, $width, $height, $level);

image

If you don't use this method getQRCodeGoogleUrl(), you can also just delete the part I selected.

image

中文回复:
我也遇到了这个问题,不过从活跃度上看,应该不在维护了,只能自行处理了。
我的处理方法如下,希望可以给遇到相同问题的人们一个参考:

将 112 行注释,并替为如下写法:

        return sprintf('https://api.qrserver.com/v1/create-qr-code/?data=%s&size=%dx%d&ecc=%s',
            $urlencoded, $width, $height, $level);

image

如果并没有使用此方法 getQRCodeGoogleUrl() ,也可以直接删除我选中的部分

image