esotalk / esoTalk

Fat-free forum software.
GNU General Public License v2.0
1.47k stars 237 forks source link

Multiple errors when saving large post (CRITICAL) #325

Open inliquid opened 10 years ago

inliquid commented 10 years ago

Most of the problems I have explained in comments here:

https://github.com/esotalk/esoTalk/commit/76c9dd60c7f60e6c2b131132ad23fef5565e87c5

Summary:

  1. No errors displayed when you post large (> 10k symbols) comment on exiting conversation. (However sometimes it was displayed and I have no idea what lead to this behaviour)
  2. No errors displayed when you post large draft (in existing conversation, not a conversation draft) - user thinks the draft was saved, but it wasn't! (Imagine the user who lost his article of > 10k symbols(!))
  3. When you try to post large message in existing conversation, number of posts will be increased by 1 each time you try. After this if real number of posts != field countPosts, any new REGULAR short post will hang the interface. So any user can break any conversation, until administator can fix this directly in db!
  4. Wrong calculation of message length for UTF-8: mb_strlen() has to be used instead of strlen

    if (mb_strlen($content, 'UTF-8') > C("esoTalk.conversation.maxCharsPerPost")) return sprintf(T("message.postTooLong"), C("esoTalk.conversation.maxCharsPerPost")); if (!mb_strlen($content, 'UTF-8')) return "emptyPost";