Undefined array key “address” in /includes/class-settings.php on line 474
-
Thrice on every WP Admin page load, the following error appears in my error log:
[25-Oct-2025 03:17:52 UTC] PHP Warning: Undefined array key "address" in /public_html/wp-content/plugins/constant-contact-forms/includes/class-settings.php on line 474Here’s the problem in bold:
line 473: $business_name = $disclosure_info['name'] ?: $business_name;
line 474: $business_addr = $disclosure_info['address'] ?: '';Both of these lines directly access array keys without checking if they exist first. If the key is missing, PHP 8 will throw an “Undefined array key” warning.
The fix is to replace those Elvis operators with null coalescing operators, like so:
$business_name = $disclosure_info['name'] ?? $business_name;
$business_addr = $disclosure_info['address'] ?? '';Would you be willing to fix this bug in your next plugin update?
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Undefined array key “address” in /includes/class-settings.php on line 474’ is closed to new replies.