Problem/Motivation

Found when testing #3351895: Add Drush command to allow running cron updates via console and by a separate user, for defense-in-depth. Got many errors like this on the console

Steps to reproduce

Proposed resolution

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

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tedbow created an issue. See original summary.

tedbow’s picture

Status: Active » Needs work
Issue tags: +Needs tests

Just putting in the fix. We will now need tests

I noticed scanForProjectName is only called in getProjectName and getProjectName marked as being tested in \Drupal\Tests\package_manager\Kernel\InstalledPackagesListTest::testPackageByDrupalProjectName but it does not call it directly. So may want to test specific to \Drupal\package_manager\InstalledPackage::getProjectName the covers that case that no info.yml as the `project` key and scanForProjectName return NULL. and a case where a top level info.yml does not have a project key but a nested on does, assuming it will find the top level one first it should not error.

phenaproxima made their first commit to this issue’s fork.

phenaproxima’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

Added test coverage and confirmed that it fails, with the expected error message, without the fix.

phenaproxima’s picture

Title: InstalledPackage::scanForProjectName should check if project key is empty before checking if it is string » InstalledPackage::scanForProjectName() can cause PHP notices if the `project` key is not in the info file
tedbow’s picture

Assigned: Unassigned » phenaproxima
Status: Needs review » Needs work

1 suggestion on the test

phenaproxima’s picture

Assigned: phenaproxima » tedbow
Status: Needs work » Needs review
tedbow’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

  • phenaproxima committed d8654de0 on 3.0.x authored by tedbow
    Issue #3358570 by phenaproxima: InstalledPackage::scanForProjectName()...
phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed
wim leers’s picture

Assigned: tedbow » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.