Commit d7e7f3ac authored by catch's avatar catch
Browse files

Issue #2730807 by Lendude, versantus.nik, cilefen, xjm, SidneyGijzen,...

Issue #2730807 by Lendude, versantus.nik, cilefen, xjm, SidneyGijzen, smustgrave, almaudoh, alexpott, danflanagan8, jordan.jamous: WSOD on admin/modules if description is set but is NULL in module.info.yml

(cherry picked from commit b1d57de4)
parent 235b1393
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -557,8 +557,13 @@ protected function createExtensionInfo(Extension $extension) {
    // contributed extensions to use for ordering extension lists.
    $info['mtime'] = $extension->getFileInfo()->getMTime();

    // Merge extension type-specific defaults.
    $info += $this->defaults;
    // Merge extension type-specific defaults, making sure to replace NULL
    // values.
    foreach ($this->defaults as $key => $default_value) {
      if (!isset($info[$key])) {
        $info[$key] = $default_value;
      }
    }

    return $info;
  }
+28 −0
Original line number Diff line number Diff line
@@ -121,6 +121,34 @@ public function testModulesListFormWithInvalidInfoFile() {
    $this->assertSession()->pageTextNotContains('Modules could not be listed due to an error');
  }

  /**
   * Tests the module form with a module with an empty description in info.yml.
   */
  public function testModulesListFormWithEmptyDescriptionInfoFile() {
    $path = \Drupal::getContainer()
      ->getParameter('site.path') . "/modules/missing_description";
    mkdir($path, 0777, TRUE);
    $file_path = "$path/missing_description.info.yml";

    $yml = <<<BROKEN
name: Module with empty description
type: module
core_version_requirement: '*'
description:
BROKEN;

    file_put_contents($file_path, $yml);

    $this->drupalGet('admin/modules');
    $this->assertSession()->statusCodeEquals(200);

    $this->assertSession()
      ->pageTextContains("Module with empty description");

    // Check that the module filter text box is available.
    $this->assertSession()->elementExists('xpath', '//input[@name="text"]');
  }

  /**
   * Confirm that module 'Required By' descriptions include dependent themes.
   */