View Issue Details

IDProjectCategoryView StatusLast Update
0000881XMB1Bugspublic2026-01-24 00:07
Reporterlottos Assigned To 
PrioritylowSeveritytweakReproducibilityalways
Status newResolutionopen 
Product Version1.9.12.06 
Summary0000881: post.php edit truncation issue - probably all xmb versions
Descriptionxmb_posts.subject is TINYTEXT (can exceed 128 chars, up to 255?)
xmb_threads.subject is VARCHAR(128)

When editing the FIRST post in a thread, XMB updates BOTH tables.
If subject exceeds threads.subject length, MySQL throws:
 "Data too long for column 'subject' (errno 1406)"

New-topic posting already truncates correctly, but the EDIT path did not.
To preserve full subject in posts while keeping threads safe:
  - Clone the already-escaped subject
  - Truncate ONLY the copy used for xmb_threads
  - Never modify $dbsubject (used by xmb_posts)

 This prevents edit-time errors without changing schema or behaviour.
 clone subject for threads
                // $dbsubject is already escaped at this point, so replace:

                if ((int) $isfirstpost['pid'] == $pid) {
                    $db->query("UPDATE ".X_PREFIX."threads SET icon='$sql_posticon', subject='$dbsubject' WHERE tid=$tid");
                }

with

                if ((int) $isfirstpost['pid'] == $pid) {
                
                $dbtsubject = $dbsubject;

                // enforce threads.subject length
                $query = $db->query("SELECT subject FROM ".X_PREFIX."threads WHERE 1=0");
                $tsubmax = $db->field_len($query, 0);
                $db->free_result($query);

                if (strlen($dbtsubject) > $tsubmax) {
                    $dbtsubject = substr($dbtsubject, 0, $tsubmax);
                }


            $db->query("UPDATE ".X_PREFIX."threads SET icon='$posticon', subject='$dbtsubject' WHERE tid=$tid");
                }
OR the DB schema could be changed :)
Steps To Reproduce
When editing the FIRST post in a thread, XMB updates BOTH tables.
If subject exceeds threads.subject length, MySQL throws:
 "Data too long for column 'subject' (errno 1406)"

TagsNo tags attached.
MySQL Version
PHP Version
Web Server
Browser
Flags
Original Reporter
SVN Revision
Git Commit

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2026-01-24 00:07 lottos New Issue