• I’ve seen the following error occur un our error logbook of some sites.

    E_WARNING: Undefined array key [NUMBER] at /PATH_TO_WP_PLUGINS/mailplus-forms/admin/classes/Setting.class.php in Spotler\Admin\Setting::apiConnectionSection line 124

    This is caused because it loops 50 times to register api settings fields, however those indexes don’t always exist on the result of the $this->getSettings(‘name’) function.

    To resolve the issue, you can do the following. Change the line below

    'name' => $this->getSettings('name')[$i],

    to

    'name' => $this->getSettings('name')[$i] ?? '',

    Please note that this suggestion only works for PHP 7.0+. If you need even more backward compatibility, you can also do this:

    // Before the for loop (makes sure to only get name settings once)
    $name_setting = $this->getSettings('name');

    // And then later
    'name' => !empty($name_setting[$i]) ? $name_setting[$i] : '';

    The change should be quite small, but prevent a lot of warnings as it triggers 50 times on every wp-admin pageload.

    If there are any questions remaining, please feel free to ask.
    Kind regards,
    Menno

  • You must be logged in to reply to this topic.