Cleaning up some old Drupal Core patches

Created on 28 February 2025, about 1 month ago

Problem/Motivation

I was looking through all the list of all the drupal/core patches that are being applied during the 5.4.x installation:

            "drupal/core": {
                .....
                "Enter drupal/core patch #850600 description here":
                "https://www.drupal.org/files/issues/2024-08-19/postgresql-ssl-dns-850600-38.patch",
                "Enter drupal/core patch #2630732 description here":
                "https://www.drupal.org/files/issues/2024-12-18/entity-fields-migration-destination-10.4.x-2630732-169.patch",
                "Enter drupal/core patch #2752443 description here":
                "https://www.drupal.org/files/issues/in_correct_order_and-2752443-1.patch",
                "Enter drupal/core patch #2816921 description here":
                "https://www.drupal.org/files/issues/user_password-2816921-2.patch",
                "Enter drupal/core patch #2857273 description here":
                "https://www.drupal.org/files/issues/2020-07-13/D91x-self_closing_correct-2857273-13.patch",
                "Enter drupal/core patch #2885370 description here":
                "https://www.drupal.org/files/issues/systemmainblock_build-2885370-3.patch",
                "Enter drupal/core patch #2893029 description here":
                "https://www.drupal.org/files/issues/2893029-9.patch",
                "Enter drupal/core patch #2938129 description here":
                .....

and I see a few that made it into the codebase and not need to reapply the patch:

"drupal/core": {
    "Enter drupal/core patch #2816921 description here":
    "https://www.drupal.org/files/issues/user_password-2816921-2.patch",
    "Enter drupal/core patch #2885370 description here":
    "https://www.drupal.org/files/issues/systemmainblock_build-2885370-3.patch",
    "3177182 - Book title in breadcrumb not translated":
    "https://www.drupal.org/files/issues/2020-10-20/book-breadcrumb_title_xlate-3177182-3.patch",
},

1. Issue https://www.drupal.org/project/drupal/issues/2816921

/core/modules/user/src/Plugin/migrate/destination/EntityUser.php - Line 143

  protected function save(ContentEntityInterface $entity, array $old_destination_id_values = []) {
    // Do not overwrite the root account password.
    if ($entity->id() != 1) {
      // Set the pre_hashed password so that the PasswordItem field does not hash
      // already hashed passwords. If the md5_passwords configuration option is
      // set we need to rehash the password and prefix with a U.
      // @see \Drupal\Core\Field\Plugin\Field\FieldType\PasswordItem::preSave()
      $entity->pass->pre_hashed = TRUE;
      if (isset($this->configuration['md5_passwords'])) {
        $entity->pass->value = 'U' . $this->password->hash($entity->pass->value);
      }
      elseif (isset($this->configuration['plaintext_passwords'])) {
        $entity->pass->value = $this->password->hash($entity->pass->value);
      }
    }
    return parent::save($entity, $old_destination_id_values);
  }

2. Issue https://www.drupal.org/project/drupal/issues/2885370

/core/modules/system/src/Plugin/Block/SystemMainBlock.php - Line 36

  /**
   * {@inheritdoc}
   */
  public function build() {
    if(empty($this->mainContent)) {
      return [];
    }
    return $this->mainContent;
  }

3. Issue https://www.drupal.org/project/drupal/issues/3177182

/core/modules/book/src/BookBreadcrumbBuilder.php - Line 108

while (!empty($book['p' . ($depth + 1)])) {
        if (!empty($parent_books[$book['p' . $depth]]) && ($parent_book = $parent_books[$book['p' . $depth]])) {
          if ($parent_book->hasTranslation($langcode)) {
            $parent_book = $parent_book->getTranslation($langcode);
          }
          $access = $parent_book->access('view', $this->account, TRUE);

I'm using a fresh 5.4.x-dev installation with Drupal Core 10.4.2 installed on it

Remaining tasks

Create a patch for remove the outdated patches.

🐛 Bug report
Status

Active

Version

5.4

Component

Code

Created by

🇨🇦Canada web247 Toronto

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

Comments & Activities

Production build 0.71.5 2024