Firstly I didn't understand what's the problem after saving a view, I got a non-informative error message:
http://drupal.org/files/PDOException%20-%20Data%20too%20long%20for%20column%20'display_title'.png

OK, I went to "Recent log messages", and I saw this error message:

"PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'display_title' at row 1: INSERT INTO {views_display} ......."

OK, in Views views_display table, display_title field's type is varchar(64).
I saw I really wanted to input a title which is more than 64 characters.
But why aren't there any checks BEFORE even trying to upload these long titles to the database? Views should output an error message, saying "Title too long, please type in a shorter title" or sg. like that.
Besides, why isn't this exception handled correctly, not to see a so non-informative error like the one linked above? (OK, maybe this is rather a general Drupal-related question, but I think Views could handle its own exceptions too...)

Comments

Jarek Polok’s picture

Same problem here, we try to expose aggregator feed (where 'title' limit is 255 chars) in a View ... where it is 64: indeed a len check would be useful ...

geek-merlin’s picture

Version: 7.x-3.5 » 7.x-3.x-dev
Issue tags: +Novice

@Sk8erPeter: thank you for your bug report.
Your question "why doesn't views check...?" is answered easily: because nobody did fix it yet - it's free software, man!
And you did the first step in the right direction.

I can confirm that the problem is also in current d7 dev.

Next step for anyone (even @Novice) who wants to help is to (maybe goto simplytest.me and) check if the problem is also in drupal8 dev (where views is in core). If yes, set version accordingly, this will strongly speed up the fix!

Dobby’s picture

Bug is not currently in D8. Fields are limited to 128 characters. However they allow you to enter more then give a warning:

Path cannot be longer than 128 characters but is currently 255 characters long.
Link text cannot be longer than 128 characters but is currently 255 characters long.
Feed path cannot be longer than 128 characters but is currently 259 characters long.
Block title cannot be longer than 128 characters but is currently 255 characters long.

It might be a good idea for the maximum length of the input field to match the maximum length of the value but it is functional as it stands.

Edit to clarify: View add form allows entry of more than 128 characters then displays above warning. View edit form appears to limit entry to 128 characters on relevant fields.

nagba’s picture

Status: Active » Needs review
StatusFileSize
new597 bytes

well if the bug doesnt appear in D8, we could just simply add a maxlength check to the display title form element.

nagba’s picture

Issue summary: View changes

plural

chris matthews’s picture

Priority: Major » Normal
Issue summary: View changes

The 6 year old patch in #4 to views_plugin_display.inc applied cleanly to the latest views 7.x-3.x-dev and if still applicable needs review.

Checking patch plugins/views_plugin_display.inc...
Hunk #1 succeeded at 1508 (offset 60 lines).
Applied patch plugins/views_plugin_display.inc cleanly.
renatog’s picture

Status: Needs review » Reviewed & tested by the community

Yeah, the patch really applied and it worked well.

Thank you so much, Balazs

  • RenatoG committed ea6ee4a on 7.x-3.x authored by nagba
    Issue #1807868 by nagba, Sk8erPeter, geek-merlin, Jarek Polok, Dobby,...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Moved to the dev branch

Thank you so much everyone

damienmckenna’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.