getDirective type error if directive not set

Created on 2 August 2024, 8 months ago
Updated 16 August 2024, 8 months ago

Problem/Motivation

If getDirective is called on a directive that has not had a value set, it will result in a type error due to the method return type:

TypeError: Drupal\csp\Csp::getDirective(): Return value must be of type array|bool, null returned

Steps to reproduce

Proposed resolution

Return a default value for unset directives.

hasDirective() is available to determine if a directive was not initialized or has an empty/default value.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇦Canada gapple

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

Comments & Activities

Production build 0.71.5 2024