Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 9 years ago

#4118 closed defect (bug) (fixed)

`primary_link` column in wp_bp_activity allows too few characters

Reported by: boonebgorges Owned by: boonebgorges
Milestone: 1.6 Priority: normal
Severity: normal Version:
Component: Activity Keywords:
Cc:

Description

The primary_link column in the activity table is set to varchar(150), and has been since the introduction of the column. It's not very uncommon for BP item URLs to be longer than this - imagine especially a forum topic inside of a group. If you have such a long URL at the moment, it gets cropped down to 150, and the primary_link (which is not used anywhere in BP to my knowledge, but is used by some plugins) ends up being incorrect.

I can't think of a good reason for having this limitation. The column is not indexed, and only in an edge case would one ever need to include it in a WHERE clause. If we must use varchar instead of something like text, let's bump the limit up to something very high, like maybe 10000.

Thoughts?

Change History (7)

#1 @DJPaul
9 years ago

primary_link is set in most of generated activity items, though it is not used further in many cases. The phpdoc says it is for "The primary URL for this item in RSS feeds (defaults to activity permalink)", but I am not sure this is still the case.

WordPress currently requires a minimum of MySQL 5.0. I suggest no more than 255 if you want to do this for a varchar. See http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html#id755686

#2 @boonebgorges
9 years ago

Good call on the MySQL varchar limitation. 255 characters is better than 150, but there will still be edge cases where it'll get truncated, and the bug will come up again. Therefore I'm leaning toward changing it to text.

#3 @DJPaul
9 years ago

  • Milestone changed from 1.5.6 to 1.6

Even if this is a change we want to make, we shouldn't make it in a minor version.

#4 @DJPaul
9 years ago

For what it's, wp_links' link_url column is a 255 varchar. wp_comments' comment_author_url is a 200 varchar. I agree 150 is short, but don't have any opinion on what to change it to (i.e. go for text).

#5 @boonebgorges
9 years ago

OK. If wp_links is varchar(255), we'll follow suit. Thanks for the feedback, DJPaul.

#6 @boonebgorges
9 years ago

  • Owner set to boonebgorges
  • Status changed from new to assigned

#7 @boonebgorges
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [5966]) Changes primary_link data type in activity table to varchar(255), to avoid unintended truncation. Fixes #4118

Note: See TracTickets for help on using tickets.