- Affected version
- 2.3.6
php's 
Consider the case;
The relevant code:
	
	
	
		
The problematic code is 
This should handle wonky time-syncs and preserve the post ordering:
	
	
	
		
Debugging this was tricky as
				
			time() function is non-monotomic. This means it can technically go backwards, noticeable on machines which use a timesync service on a very busy forumConsider the case;
- UserA starts replying- finalSetup - Clock N, Post.post_date= N
 
- finalSetup - Clock N, 
- Clock progress to N+1
- Another users posts, updating the xf_threadrecord- xf_thread.last_post_date= N+1
 
- Timsync causes the clock to be set to Clock N
- UserA's request reloads the last post information for the xf_threadrecord- Post.post_date= N
- xf_thread.last_post_date= N+1
 
- Replying fails with an internal server error.
The relevant code:
		Code:
	
	php
    $time = time();
    if ($threadLatest['last_post_date'] > $post->post_date && $threadLatest['last_post_date'] <= $time)
    {
        $post->set('post_date', $time, ['forceSet' => true]);
    }
    $this->setPostPosition($threadLatest);
`&& $threadLatest['last_post_date'] <= $timeThis should handle wonky time-syncs and preserve the post ordering:
		PHP:
	
	$time = max($threadLatest['last_post_date'], time());
if ($threadLatest['last_post_date'] > $post->post_date)
{
    $post->set('post_date', $time, ['forceSet' => true]);
}Debugging this was tricky as
setPostPosition, doesn't report the values and it assumed time() behaved itself 
 
 
		 
 
		