Commit d6596676 authored by Nigel McNie's avatar Nigel McNie
Browse files

Make db_format_timestamp return null for any value that is 'empty'.

Otherwise, $db->BindTimestamp() will return the string 'null' for 0 and '0', which no code in Mahara is expecting.

Noticed as part of the previous commit, where $user->lastlogin defaulted to 0 (which was incorrect), and which db_format_timestamp was converting to 'null'.
parent b5850666
......@@ -1361,7 +1361,9 @@ function execute_sql_arr($sqlarr, $continue=true, $feedback=true) {
function db_format_timestamp($ts) {
global $db;
if ($ts === null || $ts === '') {
// Otherwise $db->BindTimeStamp() returns the string 'null', which is not
// what we want
if (empty($ts)) {
return null;
return $db->BindTimeStamp($ts);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment