diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index cb33cbb..91229b4 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -286,6 +286,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) { $form['link_path'] = array( '#type' => 'textfield', '#title' => t('Path'), + '#maxlength' => 255, '#default_value' => $path, '#description' => t('The path for this menu link. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => '', '%add-node' => 'node/add', '%drupal' => 'http://drupal.org')), '#required' => TRUE, diff --git a/modules/menu/menu.test b/modules/menu/menu.test index d1f16f6..0fc42e1 100644 --- a/modules/menu/menu.test +++ b/modules/menu/menu.test @@ -81,6 +81,7 @@ class MenuTestCase extends DrupalWebTestCase { function doStandardMenuTests() { $this->doMenuTests(); $this->addInvalidMenuLink(); + $this->addTooLongMenuPath(); } /** @@ -329,6 +330,20 @@ class MenuTestCase extends DrupalWebTestCase { } /** + * Attempts to add a menu path with more than 255 characters (the maximum length). + * + * @param string $menu_name Menu name. + */ + function addTooLongMenuPath($menu_name = 'navigation') { + $edit = array( + 'link_path' => $this->randomName(300), + 'link_title' => $this->randomName(), + ); + $this->drupalPost("admin/structure/menu/manage/$menu_name/add", $edit, t('Save')); + $this->assertRaw(t('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => t('Path'), '%max' => 255, '%length' => 300)), 'A menu path over 255 characters is rejected.'); + } + + /** * Verify a menu link using the menu module UI. * * @param array $item Menu link.