Opened 15 years ago
Closed 11 years ago
#12264 closed defect (bug) (fixed)
links truncated: link_url column in wp_links table -- datatype too small
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.7 | Priority: | normal |
Severity: | normal | Version: | 2.9.2 |
Component: | General | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Here is my original post about the issue: http://wordpress.org/support/topic/365540?replies=3
In short, the link_url column in the wp_links table has a datatype of VARCHAR(255). As far as I know, there is no pre-defined limit to the length of a URL. However, browsers typically enforce their own practical limits, the shortest of which is much larger than the 255 character limit that WP is enforcing. Entering urls longer than 255 characters causes them to be truncated.
I tried altering the table so that link_url has a datatype of VARCHAR(1024). This allowed me to use much larger links without them being cut off. Therefore, I believe that the limiting factor is the DB and not some other code within WP.
Attachments (4)
Change History (13)
#1
@
15 years ago
- Keywords 2nd-opinion dev-feedback added; links wp_links removed
- Milestone changed from Unassigned to Future Release
#2
@
15 years ago
Thank you for your response dd32.
Because I keep getting contradictory information on the HTTP URI length specification, I have decided to look at the official docs:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html
3.2.1 General Syntax (paragraph 2 and accompanying note)
In short, according to rfc2616: "The HTTP protocol does not place any a priori limit on the length of a URI."
For the datatype, I am unsure of which would be more memory efficient, even after reading this doc: http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html
The maximum storage size of both VARCHAR and TEXT in versions of mySQL >= 5.0.3 is 65,535 bytes. It seems that it would not matter either way, but I suspect that one method may be preferred over another as a matter of best practice. I'm quite curious about this.
I think everyone can agree that URIs over 255 characters are common enough that they should be supported. And if there is a limit, it shouldn't be WordPress that is enforcing it.
I should also note that I am not an expert, and that this is my first bug report :)
#3
@
14 years ago
I'm going to chime in because this is getting more and more common. VARCHAR(1024) seems like a reasonable change in 2011. We all know shorter is better, but sometimes you get a long URL, and having to rely on manual edits OR a URL shortener seems a bit much.
#5
@
12 years ago
- Keywords needs-patch added; has-patch removed
- Milestone changed from Future Release to 3.7
Moving for review along with #17296. Needs a new patch along the lines of ticket:17296:17296.2.patch.
#6
@
12 years ago
- Cc mozillavvd@… added
- Keywords has-patch added; needs-patch removed
refresh of original patch along a new patch for #17296.
#7
@
12 years ago
I meant adding maxlength="255"
where necessary (per ocean90's comment), not changing the database field.
We could probably extend link_url
though if that's feasible, per comment:2 and comment:3.
Strangely enough, 255 is actually the correct url length limitation.
That being said, Its rare for modern applications to adhere to that standard.
Is there any particular reason this could not be stored as some form of TEXT field, or is it simply more memory efficient to use a VARCHAR instead?