Problem/Motivation

While running update.php on Drupal 10.2, the following warning is triggered:

Warning: Undefined array key "title" in Drupal\update\ProjectSecurityRequirement::createFromProjectDataAndSecurityCoverageInfo()

This occurs during update status checks and can be reproduced consistently.

Steps to reproduce

  1. Install Drupal 10.2.
  2. Ensure Update Manager (core update module) is enabled.
  3. Run /update.php.
  4. Observe PHP warning during the update process.

Actual result

The following PHP warning is displayed:

Warning: Undefined array key "title" in Drupal\update\ProjectSecurityRequirement::createFromProjectDataAndSecurityCoverageInfo()

Debugging shows that the issue originates from:

core/modules/update/src/ProjectSecurityRequirement.php:103
if (isset($project_data['existing_version'])) {
  [$major, $minor] = explode('.', $project_data['existing_version']);
  $existing_version = "$major.$minor";
  $next_version = "$major." . ((int) $minor + 1);
  return new static($project_data['title'], $security_coverage_info, $existing_version, $next_version);
}

The code assumes $project_data['title'] exists.

However, the announcements feed project entry (from Update Manager data) does not always contain a title key, which results in the undefined array key warning.

Expected result

update.php should run without PHP warnings.

The code should safely handle cases where title is missing in $project_data.

Additional context

While debugging, it was observed that the announcements feed project data does not include a title value, which leads to the warning when creating ProjectSecurityRequirement objects.

This appears to be an edge case where project data returned by the update system does not match the assumptions in ProjectSecurityRequirement::createFromProjectDataAndSecurityCoverageInfo().

Screenshot:

Announcements feed missing title

Proposed resolution

Add a defensive check before accessing $project_data['title'], for example:

$title = $project_data['title'] ?? $project_data['name'] ?? 'Unknown';
return new static($title, $security_coverage_info, $existing_version, $next_version);

Alternatively, ensure all project data provided to this method always includes a title.

Environment

  • Drupal: 10.2.x
  • PHP: (add version)
  • Reproducible: Yes

Issue fork drupal-3412207

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

lazzyvn created an issue. See original summary.

lazzyvn’s picture

Issue summary: View changes

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

samir_shukla’s picture

StatusFileSize
new855 bytes

Hi, I have created patch for the issue. Please review.

samir_shukla’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests, +Needs issue summary update

Recommended to use MRs vs patches

Tagging for issue summary as it should follow the standard issue template.

Also will need a test case.

tanmayk’s picture

Component: announcements_feed.module » other
Priority: Normal » Minor

As @smustgrave suggested, it needs issue summary with steps to reproduce the issue on fresh Drupal 10 install.

This issue may happen if module, which have hook_requirements implemented, returns an array without title in it. This title is used on Status Report page ($phase == 'runtime').

Do you have any contributed module installed which may have causing this issue? Or do you have custom modules installed as well? Try checking all entries on Status report page if it shows empty title somewhere. If you find it, please post a screenshot so we can figure out which module is causing this.

@samir_shukla This should be fixed in respective module as I mentioned above & not in core unless any core module causing this. In any case, that's not correct place to do the change :)

Version: 10.2.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ecvandenberg’s picture

This issue has a solution in /project/drupal/issues/3132426

djg_tram’s picture

That's not a solution, that's a workaround. Another year has passed and the issue is still present.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

pearls’s picture

The issue is still ongoing. We are currently using Drupal version 11.3.3.

sivaji_ganesh_jojodae’s picture

Issue summary: View changes