This issue has novice tasks. If you are an experienced core developer and have multiple commit mentions, please review novices' work on these tasks rather than doing them yourself. Feedback from experienced contributors is valued.

Problem/Motivation

  1. Clean install of Drupal 8, standard profile.
  2. Enable the forum module.
  3. Add the "New forum topics" or "Active forum topics" block to any region.

See this PHP notice:

Notice: Undefined variable: elements in Drupal\forum\Plugin\Block\ForumBlockBase->build() (line 32 of core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php).

Proposed resolution

Fix the PHP notice :)

Remaining tasks

User interface changes

n/a

API changes

n/a

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kokobutter’s picture

Assigned: Unassigned » kokobutter
kokobutter’s picture

could not recreate the problem. i did everything you mention and there were not error.

kokobutter’s picture

Status: Active » Closed (cannot reproduce)
star-szr’s picture

Assigned: kokobutter » Unassigned
Status: Closed (cannot reproduce) » Active

I tested again on a different machine and I'm still seeing this. @kokobutter it's possible your PHP error reporting is set to not show notices.

andrei.dincu’s picture

FileSize
608 bytes

I confirm this issue.
I also add a patch for it.
Only initialise $elements variable as array().
Waiting for you feedback.

andrei.dincu’s picture

Status: Active » Needs review
larowlan’s picture

Issue tags: +Needs tests
rahulbile’s picture

Status: Needs review » Reviewed & tested by the community

Tested issue and patch, and seems to be working fine.

rahulbile’s picture

Issue tags: -Needs tests
larowlan’s picture

Still needs tests?

rahulbile’s picture

Issue tags: +Needs tests
larowlan’s picture

Status: Reviewed & tested by the community » Needs work

Needs automatic tests.

should be part of ForumBlockTest

larowlan’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
888 bytes
1.46 KB

Just needed to re-order existing test, RTBC if red/green

The last submitted patch, 13: forum-block-2228941.fail_.patch, failed testing.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quick fix

Although I added patch above, it was just reordering existing tests, so think I'm still allowed to rtbc.

star-szr’s picture

+1

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Looks good!

Committed and pushed to 8.x. Thanks!

  • Commit 5c1869b on 8.x by webchick:
    Issue #2228941 by larowlan, andrei.dincu | Cottser: PHP notice displayed...

Status: Fixed » Closed (fixed)

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