summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-03-04 10:52:33 -0800
committerwebchick <webchick@24967.no-reply.drupal.org>2012-03-04 10:52:33 -0800
commitb04f183beb5dd2164029533ad2566fd704b56699 (patch)
tree0c06e74a542c3d89b2e10c3f7038feb43d3ac50a /modules/comment/comment.module
parent421d010ee6a44250e0909c427f1fbdba7e0251cf (diff)
downloadbrdo-b04f183beb5dd2164029533ad2566fd704b56699.tar.gz
brdo-b04f183beb5dd2164029533ad2566fd704b56699.tar.bz2
Issue #97327 by PMunn, NROTC_Webmaster, xjm, maartenvg, killes@www.drop.org, gdavid, Zed Pobre: Fixed Data corruption in comment IDs (results in broken threading on PostgreSQL).
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index aa512a700..e553087b0 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1499,8 +1499,11 @@ function comment_save($comment) {
$max = db_query('SELECT MAX(thread) FROM {comment} WHERE nid = :nid', array(':nid' => $comment->nid))->fetchField();
// Strip the "/" from the end of the thread.
$max = rtrim($max, '/');
+ // We need to get the value at the correct depth.
+ $parts = explode('.', $max);
+ $firstsegment = $parts[0];
// Finally, build the thread field for this new comment.
- $thread = int2vancode(vancode2int($max) + 1) . '/';
+ $thread = int2vancode(vancode2int($firstsegment) + 1) . '/';
}
else {
// This is a comment with a parent comment, so increase the part of the