• Resolved Zade

    (@nothin7)


    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 474

    Here’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)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    @nothin7

    Thanks for this info. We’ll definitely want to get the warnings resolved, and we’re getting close to a new release which we can get this included in. This has been filed internally.

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.