PHP warning if adding multiple sources in string with extra spaces

Created on 29 July 2023, over 1 year ago

Problem/Motivation

If Csp::setDirective() or Csp::appendDirective() are provided a string containing multiple sources separated by spaces, but additional whitespace is included, the the directive may have empty values added which cause later warnings.

#3223558-18: Hundreds of log entries: Uninitialized string offset: 0

Steps to reproduce

Modify a policy by calling Csp::appendDirective('script-src-attr', 'https://example.com https://example.org ')

Proposed resolution

Trim leading and trailing whitespace from input values, and improve handling string inputs to split on multiple whitespace characters.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.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