Problem/Motivation

If you have no page headers to modify then there is the following warning displayed:
Warning: foreach() argument must be of type array|object, null given in Drupal\access_unpublished\Form\SettingsForm->prepareHeadersDisplay()

Proposed resolution

Cast $headers as array to ensure warning is not shown.

Comments

kristiantosney created an issue. See original summary.

kristiantosney’s picture

StatusFileSize
new417 bytes
kristiantosney’s picture

damienmckenna’s picture

Version: 8.x-1.5 » 8.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new547 bytes

Thank you for opening the issue and providing a patch.

Does this work? It skips the foreach() loop if the $headers list is empty.

  • generalredneck committed 2ee26f2b on 8.x-1.x
    Issue #3409084 by kristiantosney, damienmckenna: Warning when visiting...
generalredneck’s picture

Status: Needs review » Fixed

Simple fix. Pushed.

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.