View Issue Details

IDProjectCategoryView StatusLast Update
0000881XMB1Bugspublic2026-05-21 07:21
Reporterlottos Assigned Tomiqrogroove  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.9.11.13 
Target Version1.9.12.10Fixed in Version1.9.12.10 
Summary0000881: post.php edit truncation issue
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 Commithttps://github.com/miqrogroove/xmb/commit/6f513f08159600e451024419c0af6c536aed4edc

Relationships

related to 0000894 new Subject Columns Should be Same Type 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2026-01-24 00:07 lottos New Issue
2026-01-31 08:11 miqrogroove Priority low => normal
2026-01-31 08:11 miqrogroove Severity tweak => minor
2026-01-31 08:11 miqrogroove Status new => confirmed
2026-01-31 08:11 miqrogroove Product Version 1.9.12.06 => 1.9.8 SP2
2026-01-31 08:11 miqrogroove Target Version => 1.9.12.10
2026-05-12 06:01 miqrogroove Relationship added related to 0000894
2026-05-21 04:27 miqrogroove Assigned To => miqrogroove
2026-05-21 04:27 miqrogroove Status confirmed => assigned
2026-05-21 05:42 miqrogroove Product Version 1.9.8 SP2 => 1.9.11.13
2026-05-21 05:45 miqrogroove Summary post.php edit truncation issue - probably all xmb versions => post.php edit truncation issue
2026-05-21 06:40 miqrogroove Status assigned => resolved
2026-05-21 06:40 miqrogroove Resolution open => fixed
2026-05-21 06:40 miqrogroove Fixed in Version => 1.9.12.10
2026-05-21 06:40 miqrogroove Git Commit => https://github.com/miqrogroove/xmb/commit/6f513f08159600e451024419c0af6c536aed4edc
2026-05-21 06:45 miqrogroove Issue cloned: 0000896
2026-05-21 07:14 miqrogroove Status resolved => closed