Settings are validated with assert() which shouldn't be relied on

Created on 4 January 2023, almost 2 years ago
Updated 26 January 2023, almost 2 years ago

Problem/Motivation

In CdnSettings.php, there are a few calls to the assert() function to verify the config. According to the PHP docs (https://www.php.net/assert), assert is only supposed to be used for debugging, not input validation. Assert can be basically turned off in php.ini, which could cause people to miss config problems that should be fixed.

Proposed resolution

Change the assert calls to something else. In buildLookupTable(), the asserts could possibly be changed to the ConfigValueException that is already used in that function. GetStreamWrappers() doesn't already use ConfigValueException and arguably isn't testing the config, but maybe it could use the same exception.

📌 Task
Status

Active

Version

4.0

Component

Code

Created by

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