Problem/Motivation

Warning: Invalid argument supplied for foreach() in comment_notify_entity_extra_field_info() (line 569 of modules/contrib/comment_notify/comment_notify.module).
comment_notify_entity_extra_field_info()

Steps to reproduce

Attach comment notify to any type like media etc.
If that doesn't exist on page, it throws warnings on pages

Proposed resolution

Check for any bundles available on that page and proceed only if that exists.

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

kirantej_p created an issue. See original summary.

kirantej_p’s picture

Add a check on the existing bundles before foreach() loop will fix those warnings.

$bundle_types = $config->get('bundle_types');
if ($bundle_types) {
  foreach ($bundle_types as $bundle_type) {
    // code
  }
}

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

the_g_bomb’s picture

Status: Active » Needs review

gnuget’s picture

Hello.

Can you provide a list of the steps to replicate the bug?

I would like to write a test.

Thanks!

cedewey’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: -PHP warnings (duplicate tag) +PHP warnings (duplicate tag)
cedewey’s picture

Version: 8.x-1.2 » 8.x-1.x-dev
Issue tags: -PHP warnings (duplicate tag) +PHP warnings (duplicate tag)