From e1a722dee799f5013cdff90c611d65a4ac760cca Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 16 Nov 2014 06:48:17 -0500 Subject: [PATCH] bug #4576 Issue with long comments on table columns Signed-off-by: Marc Delisle --- ChangeLog | 1 + libraries/DisplayResults.class.php | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 777bd9ac93..0597bff33e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ phpMyAdmin - ChangeLog - bug #4404 Recordset return from procedure display nothing - bug #4584 Edit dialog for routines is too long for smaller displays - bug #4586 Javascript error after moving a column +- bug #4576 Issue with long comments on table columns 4.2.11.0 (2014-10-31) - bug ReferenceError: Table_onover is not defined diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 212d85be86..62ba14468a 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -1808,11 +1808,20 @@ class PMA_DisplayResults && isset($comments_map[$fields_meta->table]) && isset($comments_map[$fields_meta->table][$fields_meta->name]) ) { - $comments = '' - . htmlspecialchars( - $comments_map[$fields_meta->table][$fields_meta->name] - ) - . ''; + $sanitized_comments = htmlspecialchars( + $comments_map[$fields_meta->table][$fields_meta->name] + ); + + $comments = ''; + $limitChars = $GLOBALS['cfg']['LimitChars']; + if ($GLOBALS['PMA_String']->strlen($sanitized_comments) > $limitChars) { + $sanitized_comments = $GLOBALS['PMA_String']->substr( + $sanitized_comments, 0, $limitChars + ) . '…'; + } + $comments .= $sanitized_comments; + $comments .= ''; } return $comments; } // end of the '_getCommentForRow()' function