getValueFromSettingsOrConfig fails if credentials aren't set in settings

Created on 17 February 2022, almost 3 years ago
Updated 27 June 2024, 5 months ago

Problem/Motivation

If you add the Zone ID and Authorization credentials on the Cloudflare Credentials config form but do NOT add the credentials through settings, it will cause the following error

Notice: Trying to access array offset on value of type null in Drupal\cloudflare_purge\Controller\CloudflarePurgeController->getValueFromSettingsOrConfig() (line 125 of modules/contrib/cloudflare_purge/src/Controller/CloudflarePurgeController.php).

Steps to reproduce

  1. Install and enable the Cloudflare Purge module
  2. Add Zone ID and Authorization credentials to the CloudFlare Credentials config form
  3. Attempt to purge Cloudflare

Proposed resolution

Update the getValueFromSettingsOrConfig function to leverage the $valueFromConfig when $valueFromSettings is NULL

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada nord102

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024