-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
Issue
Several calls to $this->log() in googleauthenticator.class.php use unquoted strings for the first argument.
This causes the following PHP Warning to be thrown in PHP >=7.4 when a log is attempted:
PHP warning: Use of undefined constant debug - assumed 'debug' (this will throw an Error in a future version of PHP)
Line Numbers
| Line | Code |
|---|---|
| 70 | $this->log(warn, $msg); |
| 80 | $this->log(error, $msg); |
| 96 | $this->log(error, $msg); |
| 102 | $this->log(debug, $msg); |
| 111 | $this->log(warn, "No user was found with ID:$userid"); |
| 119 | $this->log(debug, "Loading user by name:($username)"); |
| 128 | $this->log(warn, "No user was found with name:($username)"); |
| 156 | $this->log(error, "Invalid stored IV, for user:({$this->UserName}) id:{$this->UserID}"); |
| 162 | $this->log(error, "Invalid secret for user:({$this->UserName}) id:{$this->UserID}"); |
| 169 | $this->log(debug, "Data loaded for user:({$this->UserName}) id:{$this->UserID}"); |
| 172 | $this->log(error, "No Google Authenticator data were found for user:({$this->UserName}) id:{$this->UserID}"); |
| 182 | $this->log(debug, "Not a valid secret:$secret for user:({$this->UserName}) id:{$this->UserID}"); |
| 194 | $this->log(debug, "Settings saved for user:({$this->UserName}) id:{$this->UserID}"); |
| 198 | $this->log(debug, "Creating new default settings for user:({$this->UserName}) id:{$this->UserID}"); |
| 224 | $this->log(info, "gax_disabled usersetting loaded for user:({$this->UserName}) id:{$this->UserID}"); |
| 236 | $this->log(info, "gax_courtesy_enabled usersetting loaded with value {$usersettings['gax_courtesy_enabled']} for user:({$this->UserName}) id:{$this->UserID}"); |
| 240 | $this->log(debug, "Applying Global Courtesy logging value:{$GlobalCourtesyStatus}"); |
| 247 | $this->log(info, "User is in courtesy mode - user:({$this->UserName}) id:{$this->UserID}"); |
| 256 | $this->log(info, "Resetting courtesy status - user:({$this->UserName}) id:{$this->UserID}"); |
| 266 | $this->log(info, "Creating gax_disabled userSetting - user:({$this->UserName}) id:{$this->UserID}"); |
| 277 | $this->log(info, "Changing gax_disabled userSetting to:($status) - user:({$this->UserName}) id:{$this->UserID}"); |
| 325 | $this->log(error, 'Created encryption key in system settings!'); |
| 330 | $this->log(error, 'Invalid encryption key in system settings! Value was reset.'); |
Proposed Fix
Replace the first argument in each function call with a quoted string.
This would be consistent with the only other function call in the class (Line 47: $this->log('error', 'Invalid encryption key returned by "getOption", validating global setting...'););
Metadata
Metadata
Assignees
Labels
No labels