Length of menu_tree.url and menu_tree.route_param_key are too short (255 characters)

Created on 14 January 2020, almost 5 years ago
Updated 11 February 2023, almost 2 years ago

Problem/Motivation

URL/route lengths in the database need to be long enough for typical use. In reviewing the codebase, we found two menu_tree database fields (route_param_key and url) that are too short (255 characters). This can cause errors when adding data.

Steps to reproduce

To reproduce the url limitation:

1. Go to: admin/structure/menu/manage/[menuname]/add
2. Enter a very long external URL (longer than 255 characters)
3. You will get an error:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'url' at row 1

Proposed resolution

Change from 255 to 2048 in the schema and in an update hook.

Remaining tasks

User interface changes

API changes

Data model changes

The size of the menu_tree database fields (route_param_key and url) are increased.

Release notes snippet

Original report by [username]

At admin/structure/menu/manage/MENU_NAME/add, long, external URL's result in

Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'url' at row 1

The database column is only 255, set at core/lib/Drupal/Core/Menu/MenuTreeStorage.php in MenuTreeStorage::schemaDefinition()
Attached is a simple patch. Any reason not to up it?

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
Menu systemΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States jacob.embree

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024