Skip to content
Snippets Groups Projects
Unverified Commit 5b7419e8 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)

(cherry picked from commit 35044e45)
parent 8fc8778c
No related branches found
No related tags found
22 merge requests!11636Draft: Issue #3515643 by macsim: fieldNameExists method is inconsistent,!11515Issue #3480419 by mondrake, smustgrave, catch: Method...,!11380Issue #3490698 by catch, spokje: Bump MINIMUM_STABILITY back to 'stable' when...,!11281Use Drupal Core Leadership terminology in MAINTAINERS.txt,!11239Issue #3507548: Allow workspace changes listing to show all items, without a pager,!11238Fix issue #3051797,!11213Issue #3506743 by tomislav.matokovic: Increasing the color contrast for the navigation block title against the background of the navigation sidebar to at least 4.5:1,!11147Draft: Try to avoid manually setting required cache contexts,!11108Issue #3490298 by nicxvan: Profiles can be missed in OOP hooks,!11093Drupal on MongoDB 11.1.x,!11017Issue #3502540: Add date filter for moderated content.,!11009Issue #3486972 migrate feed icon,!10999Cleaning up Taxonomy hooks and updating baseline.,!10977Issue #3501457: Fix path used in a A11y Test Admin,!10881Issue #3489329 by mfb, casey: symfony/http-foundation commit 32310ff breaks PathValidator,!10570Issue #3494197: Convert Twig engine hooks,!10567Issue #3494154: Index is not added if entity doesn't support revisions,!10548Revert "Issue #3478621 by catch, longwave, nicxvan: Add filecache to OOP hook attribute parsing",!10404Margin has been added,!10391Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...,!10388Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...,!10376Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...
Pipeline #343482 canceled
Pipeline: drupal

#343483

    ...@@ -1222,7 +1222,7 @@ protected static function schemaDefinition() { ...@@ -1222,7 +1222,7 @@ protected static function schemaDefinition() {
    'route_param_key' => [ 'route_param_key' => [
    'description' => 'An encoded string of route parameters for loading by route.', 'description' => 'An encoded string of route parameters for loading by route.',
    'type' => 'varchar', 'type' => 'varchar',
    'length' => 255, 'length' => 2048,
    ], ],
    'route_parameters' => [ 'route_parameters' => [
    'description' => 'Serialized array of route parameters of this menu link.', 'description' => 'Serialized array of route parameters of this menu link.',
    ...@@ -1234,7 +1234,7 @@ protected static function schemaDefinition() { ...@@ -1234,7 +1234,7 @@ protected static function schemaDefinition() {
    'url' => [ 'url' => [
    'description' => 'The external path this link points to (when not using a route).', 'description' => 'The external path this link points to (when not using a route).',
    'type' => 'varchar', 'type' => 'varchar',
    'length' => 255, 'length' => 2048,
    'not null' => TRUE, 'not null' => TRUE,
    'default' => '', 'default' => '',
    ], ],
    ......
    ...@@ -1722,3 +1722,25 @@ function _system_advisories_requirements(array &$requirements): void { ...@@ -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.
    Finish editing this message first!
    Please register or to comment