As designed `last_edit_date` column is not updating!

CMTV

Well-known member
Affected version
2.0
Hi!

If the user is editing his published post without page reloading then last_edit_date column WILL NOT be updated!
This happens only for last_edit_date column. Other columns (like edit_count or data in xf_edit_history) are updating correctly.

So this will update last_edit_date correclty:

Publishing post ---> Reloading page ---> Editing post

This will not cause last_edit_date updating:

Publishing post ---> Editing post (without reloading the page)

This can possibly cause some "what the hell!?" exceptions (example below) when finding the difference between last_edit_date and post_date within a query!

This is how xenForo reacts when SELECTing the difference between last_edit_date and post_date:
bug_3.png

Example on test (locally hosted) forum:
bug.png
Example on real forum (>65 000 posts):
SELECT `last_edit_date`, `edit_count` FROM `xf_post` WHERE `edit_count` > 0 AND `last_edit_date` = 0
bug_2.png

Tested on latest Chrome and IE.
 
Last edited:

Mike

XenForo developer
Staff member
The last_edit_date is only updated when the edit is "visible", that is, showing a last edited message; edit_count is always updated. This is controlled by the time specified in "Enable edit log display after". (It can also be wiped out by a moderator.) If you don't want any window where this isn't the case, you should set that to 0 minutes.

The "commands out of sync" error is unrelated. See: https://dev.mysql.com/doc/refman/5.7/en/commands-out-of-sync.html Specifically, it's calling a second query without freeing the previous one. (Normally this should happen for you automatically so I'm not sure what would trigger that, perhaps unless there was an earlier error with a statement.)
 
Top