Saving a file before the settings form is saved logs a PHP warning
Part of #3596034 (closed).
Problem/Motivation
1.5.0 has no config/install, so c2pa_sign.settings does not exist until the settings form is saved. c2pa_sign_presave_file() reads $config->get('assertions')['upload']. On a new site every file save logs Warning: Trying to access array offset on null at c2pa_sign.module:166.
Steps to reproduce
- Install the module on a new site.
- Upload any file. The log shows the warning.
Proposed resolution
Read the key with $config->get('assertions.upload').
Definition of done
- No warning on file save without
c2pa_sign.settings - Signing stays off until the settings are saved
AI Compliance
🤖 Generated with the help of an LLM, reviewed and approved by me before posting.
Edited by Giorgio Alfredo Pagano