Skip to content
Snippets Groups Projects

Issue #3358570: InstalledPackage::scanForProjectName should check if project key is empty before checking if it is string

Merged Issue #3358570: InstalledPackage::scanForProjectName should check if project key is empty before checking if it is string
2 unresolved threads
2 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
98 98 $info = file_get_contents($match[0]);
99 99 $info = Yaml::decode($info);
100 100
101 if (is_string($info['project']) && !empty($info['project'])) {
101 if (!empty($info['project']) && is_string($info['project'])) {
  • Adam G-H added 5 commits

    added 5 commits

    Compare with previous version

  • Ted Bowman added 2 commits

    added 2 commits

    • 1488d68c - 1 commit from branch project:3.0.x
    • 0c34dd44 - Merge branch '3.0.x' into 3358570-check-empty-first

    Compare with previous version

  • 123 123
    124 // The `project` key has been removed from the info file.
    125 (new ActiveFixtureManipulator())
    126 ->addProjectAtPath('projects/no_project_key')
    127 ->commitChanges();
    128 $list = new InstalledPackagesList([
    129 'drupal/no_project_key' => InstalledPackage::createFromArray([
    130 'name' => 'drupal/no_project_key',
    131 'version' => '1.0.0',
    132 'type' => 'drupal-module',
    133 'path' => $projects_path . '/no_project_key',
    134 ]),
    135 ]);
    136 $info_file = $list['drupal/no_project_key']->path . '/no_project_key.info.yml';
    137 $this->assertFileIsWritable($info_file);
    138 file_put_contents($info_file, '{}');
    • Author Maintainer
      Suggested change
      138 file_put_contents($info_file, '{}');
      138 $info_contents = Yaml::decode(file_get_contents($info_file));
      139 $this->assertArrayHasKey('project', $info_contents);
      140 unset($info_contents['project']);
      141 file_put_contents($info_file, Yaml::encode($info_contents));

      If we just set the how file as empty we can't really be sure in the test that won't run into the same original problem if the file had other valid values. This test assumes the file won't be skipped for other reasons if it is not valid.

      We should be changing only the project key.

      Edited by Ted Bowman
    • Adam G-H changed this line in version 4 of the diff

      changed this line in version 4 of the diff

    • Please register or sign in to reply
  • Adam G-H added 3 commits

    added 3 commits

    • b25a4b77 - Merge branch '3.0.x' into 3358570-check-empty-first
    • 5dc34c65 - Specifically unset the project key
    • d512e40d - Merge branch '3358570-check-empty-first' of...

    Compare with previous version

  • merged

  • Please register or sign in to reply
    Loading