diff --git a/ChangeLog b/ChangeLog
index 200b09c..9844b46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,7 @@ Version 5.0.2, 2026-05-05
- Robustness & i18n
- **`DieWithErrorMsg` / `DieWithFriendlyErrorMsg`**: fix invalid extra `
` in the auxiliary error table; normalise detail rows; correct friendly-error footer cell markup; trim redundant padding `
` in error cells ([`functions_common.php`](src/include/functions_common.php)).
- Export placeholder copy: strip decorative **`>` / `<`** from **`LN_GEN_SELECTEXPORT`** in en/de/es/ja `main.php`.
+ - PHP 8.1+: cast event timestamps to **`int`** before **`date()`** in disk consolidation/chart helpers, grid date formatting, DB/PDO/ClickHouse date-range filters, and export filenames; fix wrong field variable in disk **`ConsolidateItemListByField`** / **`ConsolidateDataByField`** date grouping ([#132](https://github.com/rsyslog/loganalyzer/issues/132), thanks **@KDocProf**).
- E2E / Playwright
- **`Modern theme visual review`**: switch session style via `userchange.php`, assert theme stylesheets, capture **`modern-01`…`modern-05`** screenshots under `e2e/test-results/ci-visual/` (index grid, **details dialog**, admin index, advanced search, reports).
diff --git a/src/classes/logstreamclickhouse.class.php b/src/classes/logstreamclickhouse.class.php
index 79790b1..a6d7b51 100644
--- a/src/classes/logstreamclickhouse.class.php
+++ b/src/classes/logstreamclickhouse.class.php
@@ -1518,20 +1518,20 @@ private function CreateSQLWhereClause()
{
// Obtain Event struct for the time!
$myeventtime = GetEventTime($myfilter[FILTER_VALUE]);
- $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "'";
+ $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP]) . "'";
}
else if ( $myfilter[FILTER_DATEMODE] == DATEMODE_RANGE_TO )
{
// Obtain Event struct for the time!
$myeventtime = GetEventTime($myfilter[FILTER_VALUE]);
- $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "'";
+ $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP]) . "'";
}
else if ( $myfilter[FILTER_DATEMODE] == DATEMODE_RANGE_DATE )
{
// Obtain Event struct for the time!
$myeventtime = GetEventTime($myfilter[FILTER_VALUE]);
- $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "' AND " .
- $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", ($myeventtime[EVTIME_TIMESTAMP]+86400) ) . "'";
+ $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP]) . "' AND " .
+ $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP] + 86400 ) . "'";
}
break;
diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php
index 26709c6..ebe4ea3 100644
--- a/src/classes/logstreamdb.class.php
+++ b/src/classes/logstreamdb.class.php
@@ -1547,20 +1547,20 @@ private function CreateSQLWhereClause()
{
// Obtain Event struct for the time!
$myeventtime = GetEventTime($myfilter[FILTER_VALUE]);
- $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "'";
+ $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP]) . "'";
}
else if ( $myfilter[FILTER_DATEMODE] == DATEMODE_RANGE_TO )
{
// Obtain Event struct for the time!
$myeventtime = GetEventTime($myfilter[FILTER_VALUE]);
- $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "'";
+ $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP]) . "'";
}
else if ( $myfilter[FILTER_DATEMODE] == DATEMODE_RANGE_DATE )
{
// Obtain Event struct for the time!
$myeventtime = GetEventTime($myfilter[FILTER_VALUE]);
- $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "' AND " .
- $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", ($myeventtime[EVTIME_TIMESTAMP]+86400) ) . "'";
+ $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP]) . "' AND " .
+ $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP] + 86400 ) . "'";
}
break;
diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php
index c6b12b1..c0c9628 100644
--- a/src/classes/logstreamdisk.class.php
+++ b/src/classes/logstreamdisk.class.php
@@ -821,7 +821,7 @@ public function ConsolidateItemListByField($szConsFieldId, $nRecordLimit, $szSor
if ( $nConsFieldType == FILTER_TYPE_DATE )
{
// Convert to FULL Day Date for now!
- $myFieldData = date( "Y-m-d", $logArray[$szFieldId][EVTIME_TIMESTAMP] );
+ $myFieldData = date( "Y-m-d", (int)$logArray[$szConsFieldId][EVTIME_TIMESTAMP] );
}
else // Just copy the value!
$myFieldData = $logArray[$szConsFieldId];
@@ -914,7 +914,7 @@ public function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFie
if ( $nConsFieldType == FILTER_TYPE_DATE )
{
// Convert to FULL Day Date for now!
- $myFieldData = date( "Y-m-d", $logArray[$szFieldId][EVTIME_TIMESTAMP] );
+ $myFieldData = date( "Y-m-d", (int)$logArray[$szConsFieldId][EVTIME_TIMESTAMP] );
}
else // Just copy the value!
$myFieldData = $logArray[$szConsFieldId];
@@ -1017,7 +1017,7 @@ public function GetCountSortedByField($szFieldId, $nFieldType, $nRecordLimit)
if ( $nFieldType == FILTER_TYPE_DATE )
{
// Convert to FULL Day Date for now!
- $myFieldData = date( "Y-m-d", $logArray[$szFieldId][EVTIME_TIMESTAMP] );
+ $myFieldData = date( "Y-m-d", (int)$logArray[$szFieldId][EVTIME_TIMESTAMP] );
}
else // Just copy the value!
$myFieldData = $logArray[$szFieldId];
diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php
index bbacb43..02d7b35 100644
--- a/src/classes/logstreampdo.class.php
+++ b/src/classes/logstreampdo.class.php
@@ -1852,20 +1852,20 @@ private function CreateSQLWhereClause()
{
// Obtain Event struct for the time!
$myeventtime = GetEventTime($myfilter[FILTER_VALUE]);
- $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "'";
+ $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP]) . "'";
}
else if ( $myfilter[FILTER_DATEMODE] == DATEMODE_RANGE_TO )
{
// Obtain Event struct for the time!
$myeventtime = GetEventTime($myfilter[FILTER_VALUE]);
- $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "'";
+ $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP]) . "'";
}
else if ( $myfilter[FILTER_DATEMODE] == DATEMODE_RANGE_DATE )
{
// Obtain Event struct for the time!
$myeventtime = GetEventTime($myfilter[FILTER_VALUE]);
- $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "' AND " .
- $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", ($myeventtime[EVTIME_TIMESTAMP]+86400) ) . "'";
+ $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP]) . "' AND " .
+ $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " < '" . date("Y-m-d H:i:s", (int)$myeventtime[EVTIME_TIMESTAMP] + 86400 ) . "'";
}
break;
diff --git a/src/export.php b/src/export.php
index 25adb1c..9b39e9b 100644
--- a/src/export.php
+++ b/src/export.php
@@ -400,7 +400,7 @@
$szOutputCharset = "";
$szOutputFileName = isset($content['period_start_ts'])
- ? "ExportMessages_" . date('Ymd\THis', $content['period_start_ts']) . "-" . date('Ymd\THis', $content['period_end_ts'])
+ ? "ExportMessages_" . date('Ymd\THis', (int)$content['period_start_ts']) . "-" . date('Ymd\THis', (int)$content['period_end_ts'])
: "ExportMessages";
$szOutputFileExtension = ".txt";
$szOPFieldSeparator = " ";
diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php
index 0626dc6..368d6d8 100644
--- a/src/include/functions_frontendhelpers.php
+++ b/src/include/functions_frontendhelpers.php
@@ -230,14 +230,14 @@ function GetFormatedDate($evttimearray, $onExport = false)
($onExport == true && GetConfigSetting("ExportUseTodayYesterday", 0, CFGLEVEL_USER) == 1)
|| (
$onExport == false && GetConfigSetting("ViewUseTodayYesterday", 0, CFGLEVEL_USER) == 1
- && ( date('m', $evttimearray[EVTIME_TIMESTAMP]) == date('m') && date('Y', $evttimearray[EVTIME_TIMESTAMP]) == date('Y') )
+ && ( date('m', (int)$evttimearray[EVTIME_TIMESTAMP]) == date('m') && date('Y', (int)$evttimearray[EVTIME_TIMESTAMP]) == date('Y') )
)
)
{
- if ( date('d', $evttimearray[EVTIME_TIMESTAMP]) == date('d') )
- return "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
- else if ( date('d', $evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') )
- return "Yesterday " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
+ if ( date('d', (int)$evttimearray[EVTIME_TIMESTAMP]) == date('d') )
+ return "Today " . date("H:i:s", (int)$evttimearray[EVTIME_TIMESTAMP] );
+ else if ( date('d', (int)$evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') )
+ return "Yesterday " . date("H:i:s", (int)$evttimearray[EVTIME_TIMESTAMP] );
}
// Copy to local variable
@@ -251,7 +251,7 @@ function GetFormatedDate($evttimearray, $onExport = false)
}
// Reach return normal format!
- return $szDateFormatted = date("Y-m-d H:i:s", $nMyTimeStamp );
+ return $szDateFormatted = date("Y-m-d H:i:s", (int)$nMyTimeStamp );
}
function GetDebugBgColor( $szDebugMode )