tiki-webmail.php line 420
When visiting the webmail mailbox, I get two errors — the second of which is cascaded by the first:
Copy to clipboard
Notice: Undefined index: Date in .../tiki-webmail.php on line 420 Notice: strtotime(): Called with empty time parameter in .../tiki-webmail.php on line 420
The refenced code is:
Copy to clipboard
[LINE 420] $aux["timestamp"] = strtotime($aux['Date']);
I used the PHP function print_r() to inspect what the $aux array contains. The culprit turned out to be the absence of a 'Date' record. Instead, the message header as parsed from qmail apparently replaces that with a 'Received' array.
Copy to clipboard
Array ( [Return-Path] => <ac...@ho...> [Delivered-To] => ac...@ho... [Received] => Array ( [0] => (qmail # invoked by uid #); 2 Jan 2006 23:56:00 -0000
My fix (yes, it works) is to check for the known header variants in order to extract the date value, as such:
Copy to clipboard
if (array_key_exists('Date',$aux)) { $aux["timestamp"] = strtotime($aux['Date']); } elseif (array_key_exists('Received',$aux)) { list ($sz_to_dev_nul, $sz_to_Date) = explode(';',$aux['Received'][0],2); $aux["timestamp"] = strtotime($sz_to_Date); } else { $aux["timestamp"] = ''; }