Skip to content
Snippets Groups Projects
Commit 9ce63f38 authored by Jared Hancock's avatar Jared Hancock
Browse files

Truncate thread messages that cannot be sent to db

parent 2695dceb
No related branches found
No related tags found
No related merge requests found
......@@ -1272,6 +1272,11 @@ class ThreadBody /* extends SplString */ {
if (!in_array($type, static::$types))
throw new Exception($type.': Unsupported ThreadBody type');
$this->body = (string) $body;
if (strlen($this->body) > 250000) {
$max_packet = db_get_variable('max_allowed_packet', 'global');
// Truncate just short of the max_allowed_packet
$this->body = substr($this->body, $max_packet - 2048) . ' ... (truncated)';
}
$this->type = $type;
$this->options = array_merge($this->options, $options);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment