silence
Well-known member
Here is the function:
Basically I'm using it to check if user_id 0 is valid. It queries `xf_user` for 0, returns false. Then it checks if the query and the parameter user_id are equal, and since false = 0, it returns true!
Soooooooooo yeah is this a glitch cause it feels like it is to me :C
PHP:
public static function verifyUserId(&$user_id, XenForo_DataWriter $dw, $fieldName = false)
{
$db = XenForo_Application::getDb();
$existing_user_id = $db->fetchOne('
SELECT user_id
FROM xf_user
WHERE user_id = ?
', $user_id);
if ($existing_user_id == $user_id)
{
return true;
}
$dw->error(new XenForo_Phrase('requested_user_not_found'), $fieldName);
return false;
}
Basically I'm using it to check if user_id 0 is valid. It queries `xf_user` for 0, returns false. Then it checks if the query and the parameter user_id are equal, and since false = 0, it returns true!
Soooooooooo yeah is this a glitch cause it feels like it is to me :C