X Xon Well-known member Dec 31, 2015 #1 Ordering of IPs isn't matching the expected 'ORDER BY log_date DESC' inside XenForo_Model_Ip::getIpsByUserId I've had this happening with MariaDB 5.x, 10.0.x, 10.1.x; This user does have some IPv6 addresses (off screen somewhere). Last edited: Dec 31, 2015
Ordering of IPs isn't matching the expected 'ORDER BY log_date DESC' inside XenForo_Model_Ip::getIpsByUserId I've had this happening with MariaDB 5.x, 10.0.x, 10.1.x; This user does have some IPv6 addresses (off screen somewhere).
X Xon Well-known member Dec 31, 2015 #2 The bug is with the MAX(log_date) vs the ORDER BY clause: Code: SELECT MAX(log_date), ip FROM xf_ip WHERE user_id = ? GROUP BY ip ORDER BY log_date DESC This sorts from newest to oldest, but only displays the oldest logged date. This means if someone switches devices and back again, the most recent IP is stuck down on the list somewhere. Last edited: Dec 31, 2015
The bug is with the MAX(log_date) vs the ORDER BY clause: Code: SELECT MAX(log_date), ip FROM xf_ip WHERE user_id = ? GROUP BY ip ORDER BY log_date DESC This sorts from newest to oldest, but only displays the oldest logged date. This means if someone switches devices and back again, the most recent IP is stuck down on the list somewhere.
Mike XenForo developer Staff member Jan 7, 2016 #3 Sorting by the MAX(log_date) should be acceptable/valid and makes the order more predictable at least.
Sorting by the MAX(log_date) should be acceptable/valid and makes the order more predictable at least.