From 3dfda456816cab93a8d8518e0891d2b403ac8509 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 16 May 2025 11:54:05 +0200 Subject: [PATCH] GenericTable: better handling of null values for timestamps --- controllers/ManageUsers.php | 1 + models/GenericTable.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/ManageUsers.php b/controllers/ManageUsers.php index 8473596..9e80cb9 100644 --- a/controllers/ManageUsers.php +++ b/controllers/ManageUsers.php @@ -62,6 +62,7 @@ class ManageUsers extends HTMLController 'type' => 'timestamp', 'pattern' => 'long', 'value' => 'last_action_time', + 'if_null' => 'n/a', ], 'header' => 'Last activity', 'is_sortable' => true, diff --git a/models/GenericTable.php b/models/GenericTable.php index ec76a1a..7291461 100644 --- a/models/GenericTable.php +++ b/models/GenericTable.php @@ -226,8 +226,8 @@ class GenericTable else $pattern = $options['pattern']; - assert(isset($rowData[$options['value']])); - if (!is_numeric($rowData[$options['value']])) + assert(array_key_exists($options['value'], $rowData)); + if (isset($rowData[$options['value']]) && !is_numeric($rowData[$options['value']])) $timestamp = strtotime($rowData[$options['value']]); else $timestamp = (int) $rowData[$options['value']];