PHP Warning on Activity List
-
I notice that when I look at the Secure Passkeys->Activity Log in my Admin section, this PHP Warning is logged:
PHP Warning: Undefined property: stdClass::$is_active in /var/web/site/public_html/wp-content/plugins/secure-passkeys/src/ajax/secure-passkeys-adminarea-ajax.php on line 218
It doesn’t seem to affect anything. Line 218 is:
$record->is_active = intval($record->is_active);
So I looked a little bit more and notice that in an earlier section of secure-passkeys-adminarea-ajax.php, there is this query where is_active exists in the table Secure_passkeys_webauthns table:$records = (new Secure_Passkeys_WebAuthn())->get_all_paginate([
‘id’, ‘user_id’, ‘is_active’, ‘security_key_name’, ‘aaguid’, ‘last_used_at’, ‘created_at’
], 20, $filters);$records = (new Secure_Passkeys_WebAuthn())->get_all_paginate([
'id', 'user_id', 'is_active', 'security_key_name', 'aaguid', 'last_used_at', 'created_at'
], 20, $filters);
array_map(function ($record) {
$record->is_active = intval($record->is_active);
$record->aaguid = Secure_Passkeys_Webauthn_Helper::get_authenticator($record->aaguid);
$record->user = Secure_Passkeys_Helper::get_user_object_by_id(intval($record->user_id));
$record->last_used_on = Secure_Passkeys_Helper::get_datetime_from_now($record->last_used_at);
}, $records['records'] ?? []);However in the table secure_passkeys_logs, is_active is not a column. So perhaps this array_map call should not include the is_active field.
$records = (new Secure_Passkeys_Log())->get_all_paginate([
'id', 'user_id', 'security_key_name', 'aaguid', 'admin_id', 'log_type', 'ip_address', 'created_at'
], 20, $filters);
array_map(function ($record) {
$aaguid_friendly_name = Secure_Passkeys_Webauthn_Helper::get_friendly_name($record->aaguid);
$record->is_active = intval($record->is_active); //Maybe remove this line.
$record->localized_log_type = Secure_Passkeys_Log::get_localized_log_type($record->log_type);
$record->description = Secure_Passkeys_Log::get_log_line($record->log_type, $record->security_key_name, $aaguid_friendly_name);
$record->user = Secure_Passkeys_Helper::get_user_object_by_id(intval($record->user_id));
$record->admin = Secure_Passkeys_Helper::get_user_object_by_id(intval($record->admin_id));
}, $records['records'] ?? []);
The topic ‘PHP Warning on Activity List’ is closed to new replies.