Commit 2b8b254c authored by Nigel McNie's avatar Nigel McNie
Browse files

(#3098) Speculative fix - allow user ID 0 to be retrieved by

User->find_by_id.
parent 36ca25fd
...@@ -117,7 +117,7 @@ class User { ...@@ -117,7 +117,7 @@ class User {
WHERE WHERE
id = ?'; id = ?';
$user = get_record_sql($sql, $id); $user = get_record_sql($sql, array($id));
if (false == $user) { if (false == $user) {
throw new AuthUnknownUserException("User with id \"$id\" is not known"); throw new AuthUnknownUserException("User with id \"$id\" is not known");
......
...@@ -917,7 +917,7 @@ function can_send_message($from, $to) { ...@@ -917,7 +917,7 @@ function can_send_message($from, $to) {
} }
function load_user_institutions($userid) { function load_user_institutions($userid) {
if (empty($userid)) { if (!is_numeric($userid) || $userid < 0) {
throw new InvalidArgumentException("couldn't load institutions, no user id specified"); throw new InvalidArgumentException("couldn't load institutions, no user id specified");
} }
if ($institutions = get_records_sql_assoc(' if ($institutions = get_records_sql_assoc('
......
Supports Markdown
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