Skip to content
Snippets Groups Projects
Unverified Commit 35044e45 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3106205 by jrglasgow, plopesc, jonathan1055, smustgrave, edmund.dunn,...

Issue #3106205 by jrglasgow, plopesc, jonathan1055, smustgrave, edmund.dunn, heddn, narendra.rajwar27, jamiehollern, joshua1234511, murilohp, jacob.embree, mayurjadhav, raman.b, voviko, sonnykt, catch, kristen pol, dspachos, longwave, fmb, quietone, xjm, larowlan, devad: Length of menu_tree.url and menu_tree.route_param_key are too short (255 characters)
parent 9cf58fe1
Branches
Tags
14 merge requests!11197Issue #3506427 by eduardo morales alberti: Remove responsive_image.ajax from hook,!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!10786Issue #3490579 by shalini_jha, mstrelan: Add void return to all views...,!10210Issue #3487907: Drupal.displace() use getComputedStyle() for hidden chk.,!5423Draft: Resolve #3329907 "Test2",!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3478Issue #3337882: Deleted menus are not removed from content type config,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #343345 failed
......@@ -1222,7 +1222,7 @@ protected static function schemaDefinition() {
'route_param_key' => [
'description' => 'An encoded string of route parameters for loading by route.',
'type' => 'varchar',
'length' => 255,
'length' => 2048,
],
'route_parameters' => [
'description' => 'Serialized array of route parameters of this menu link.',
......@@ -1234,7 +1234,7 @@ protected static function schemaDefinition() {
'url' => [
'description' => 'The external path this link points to (when not using a route).',
'type' => 'varchar',
'length' => 255,
'length' => 2048,
'not null' => TRUE,
'default' => '',
],
......
......@@ -1722,3 +1722,25 @@ function _system_advisories_requirements(array &$requirements): void {
}
}
}
/**
* Update length of menu_tree fields url and route_param_key from 255 to 2048.
*/
function system_update_11001(): void {
$schema = \Drupal::database()->schema();
$spec = [
'description' => 'The external path this link points to (when not using a route).',
'type' => 'varchar',
'length' => 2048,
'not null' => TRUE,
'default' => '',
];
$schema->changeField('menu_tree', 'url', 'url', $spec);
$spec = [
'description' => 'An encoded string of route parameters for loading by route.',
'type' => 'varchar',
'length' => 2048,
];
$schema->changeField('menu_tree', 'route_param_key', 'route_param_key', $spec);
}
<?php
declare(strict_types=1);
namespace Drupal\Tests\system\Functional\Update;
use Drupal\Core\Database\Connection;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests update of menu tree storage fields.
*
* @group system
*/
class MenuTreeStorageSchemaUpdateTest extends UpdatePathTestBase {
/**
* The database.
*
* @var \Drupal\Core\Database\Connection
*/
protected Connection $connection;
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
/** @var \Drupal\Core\Database\Connection $connection */
$this->connection = \Drupal::service('database');
}
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles(): void {
$this->databaseDumpFiles = [
// Start with a bare installation of Drupal 10.3.0.
DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-10.3.0.bare.standard.php.gz',
];
}
/**
* Tests DB behavior after update.
*/
public function testSchemaLengthAfterUpdate(): void {
if (\Drupal::service('database')->databaseType() == 'sqlite') {
$this->markTestSkipped("This test does not support the SQLite database driver.");
}
$results = $this->connection->query('SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = :menu AND COLUMN_NAME IN ( :column_names[] )', [
':menu' => $this->connection->schema()->prefixNonTable('menu_tree'),
':column_names[]' => ['route_param_key', 'url'],
])->fetchCol();
$this->assertNotEmpty($results);
foreach ($results as $result) {
self::assertEquals(255, $result);
}
$this->runUpdates();
$results = $this->connection->query('SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = :menu AND COLUMN_NAME IN ( :column_names[] )', [
':menu' => $this->connection->schema()->prefixNonTable('menu_tree'),
':column_names[]' => ['route_param_key', 'url'],
])->fetchCol();
$this->assertNotEmpty($results);
foreach ($results as $result) {
self::assertEquals(2048, $result);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment