Closed Hydranet closed 1 year ago
I get the same error as of today, (although has been on php8.2 fine for months.)
Is possibly related to PR https://github.com/alexandregz/twofactor_gauthenticator/pull/166
Please can you tag a release/stable version so that composer doesn't automatically upgrade to this version in dev-master and break things.
I get the same error as of today, (although has been on php8.2 fine for months.)
You are right it has been working with php8.2 until a few days ago, If checkout to commit 3c76f459e83f06c965e140a1f344fdcb0f4030e2 it works again.
If you do a "git diff" between the current HEAD 3c76f459e83f06c965e140a1f344fdcb0f4030e2 and the last working commit 085abfb14a4321b5e3b81a7053ac978a816a7be4 you see that the following lines have been changed.
class twofactor_gauthenticator extends rcube_plugin
{
private $_number_recovery_codes = 4;
- // relative from RC home dir, not plugin directory
- private $_logs_file = '/logs/log_errors_2FA.txt';
+ // relative to $config['log_dir']
+ private $_logs_file = 'log_errors_2FA.txt';
function init()
{
class twofactor_gauthenticator extends rcube_plugin
// log error into $_logs_file directory
private function __logError() {
- file_put_contents(realpath(".").$this->_logs_file, date("Y-m-d H:i:s")."|".$_SERVER['HTTP_X_FORWARDED_FOR']."|".$_SERVER['REMOTE_ADDR']."\n", FILE_APPEND);
+ $_log_dir = $rcmail->config->get('log_dir')
+ file_put_contents($_log_dir.'/'.$this->_logs_file, date("Y-m-d H:i:s")."|".$_SERVER['HTTP_X_FORWARDED_FOR']."|".$_SERVER['REMOTE_ADDR']."\n", FILE_APPEND);
}
}
Just a headsup This didn't work on windows with PHP 8.1 and Roundcube 1.5.2
$_log_dir = $rcmail->config->get('log_dir')
but this worked
$_log_dir = rcmail::get_instance()->config->get('log_dir');
By the way this gives an error when going to the settings page ANY HELP PLEASE
somewhere around line 281 in public function twofactor_gauthenticator_form()
if(array_key_exists('secret', $data)){ $activateData['checked'] = "checked"; }
Error as below,
`[17-Jun-2023 09:22:48 Asia/Kolkata] PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in C:\inetpub\wwwroot\roundcube\plugins\twofactor_gauthenticator\twofactor_gauthenticator.php:283 Stack trace:
thrown in C:\inetpub\wwwroot\roundcube\plugins\twofactor_gauthenticator\twofactor_gauthenticator.php on line 283`
When you try to load the Roundcube login page with the twofactor_gauthenticator plugin enabled you get an "Internal Error". When I check the php -fpm log file I see the following.
[14-Jun-2023 07:54:11 UTC] PHP Parse error: syntax error, unexpected identifier "file_put_contents" in /data/websites/roundcube/html/plugins/twofactor_gauthenticator/twofactor_gauthenticator.php on line 546