Problem/Motivation

EntityFieldManager::getFieldDefinitions() does not type its $bundle argument, so a caller passing NULL reaches buildBundleFieldDefinitions() and then this alter hook. The non-nullable string parameter then throws a TypeError.

Steps to reproduce

Try to use Canvas Override with Canvas Tools and the MCP server suite.

Proposed resolution

-  public function entityBundleFieldInfoAlter(array &$fields, EntityTypeInterface $entity_type, string $bundle): void {
+  public function entityBundleFieldInfoAlter(array &$fields, EntityTypeInterface $entity_type, ?string $bundle): void {

Remaining tasks

  • ✅ File an issue
  • ➖ Addition/Change/Update/Fix
  • ➖ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ➖ UX/UI designer responsibilities
  • ➖ Readability
  • ➖ Accessibility
  • ➖ Performance
  • ➖ Security
  • ➖ Developer Documentation
  • ➖ User Guide Documentation
  • ➖ Reviewed by human
  • ➖ Code review by maintainers
  • ➖ Full testing and approval
  • ➖ Credit contributors
  • ➖ Review with the product owner
  • ➖ Release notes snippet
  • ❌ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
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

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs review
rajab natshah’s picture

Title: Accept a NULL bundle in hook_entity_bundle_field_info_alter() » Accept a NULL bundle in hook_entity_bundle_field_info_alter() instead of throwing a TypeError

rajab natshah’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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