You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Warning [2] Trying to access array offset on value of type null - Line: 243 - File: admin/modules/config/formcreator.php PHP 8.1.16 (Linux)
Warning [2] Trying to access array offset on value of type null - Line: 246 - File: admin/modules/config/formcreator.php PHP 8.1.16 (Linux)
(The above 3 warnings are repeated multiple times)
Warning [2] Trying to access array offset on value of type null - Line: 264 - File: admin/modules/config/formcreator.php PHP 8.1.16 (Linux)
Warning [2] Trying to access array offset on value of type null - Line: 268 - File: admin/modules/config/formcreator.php PHP 8.1.16 (Linux)
Warning [2] Trying to access array offset on value of type null - Line: 270 - File: admin/modules/config/formcreator.php PHP 8.1.16 (Linux)
After the "Process Options" block
Warning [2] Trying to access array offset on value of type null - Line: 294 - File: admin/modules/config/formcreator.php PHP 8.1.16 (Linux)
Warning [2] Trying to access array offset on value of type null - Line: 297 - File: admin/modules/config/formcreator.php PHP 8.1.16 (Linux)
(Note that some of the later line numbers won't line up as I was debugging the code, but in general they occurred whenever $formcreator->setting['somevalue'] appears)
To Reproduce
Steps to reproduce the behavior:
Go to Configuration -> Form Creator
See error
Expected behavior
No PHP warning. These don't impact the functionality, the warnings are largely annoying and make error logging tedious.
Desktop (please complete the following information):
MyBB version: 1.8.36
Plugin version: 2.6.6
PHP version: 8.1.16
MySQL version: 5.7
Possible fix(s):
Warning 1:
I changed the line in question from: if ($mybb->input['page']) {
to if (isset($mybb->input['page'])) {
and that seemed to resolve the warning.
Warning 2-4:
I replaced the set code for the allowed gid types with:
$radioboxes = "";
$option_gidtypeAll = array();
$option_gidtypeSelected = array();
$option_gidtypeUnselected = array();
if(isset($form_container->settings['allowedgidtype'])){
switch($form_container->settings['allowedgidtype']){
case -1:
$option_gidtypeAll[] =["checked" => 1];
break;
case 0:
$option_gidtypeSelected[] = ["checked" => 1];
break;
case 1:
$option_gidtypeUnselected[] = ["checked" => 1];
break;
default:
break;
}
} else {
//set default radio button for when 'allowedgidtype' is not set
$option_gidtypeSelected[] = ["checked" => 1];
}
$radioboxes .= $form->generate_radio_button("settings[allowedgidtype]", -1, $lang->fc_allow_all_groups, $option_gidtypeAll) . "<br />";
$radioboxes .= $form->generate_radio_button("settings[allowedgidtype]", 0, $lang->fc_allow_selected_groups, $option_gidtypeSelected) . "<br />";
$radioboxes .= $form->generate_radio_button("settings[allowedgidtype]", 1, $lang->fc_allow_unselected_groups, $option_gidtypeUnselected);
Warning 5-7
I replaced the following lines:
//check if set for PHP 8 compatibility, set to default if not
$allowedgidvalue = isset($formcreator->settings['allowedgid']) ? $formcreator->settings['allowedgid'] : array();
$customdeniedvalue = isset($formcreator->settings['customdenied']) ? $formcreator->settings['customdenied'] : "";
$limitusagevalue = isset($formcreator->settings['limitusage']) ? $formcreator->settings['limitusage'] : "";
$form_container->output_row($lang->fc_allowed_groups." <em>*</em>", $lang->fc_allowed_groups_desc, $radioboxes . "<br /><br />" . $form->
generate_group_select("settings[allowedgid][]", $allowedgidvalue, array("multiple" => true)));
$form_container->output_row($lang->fc_custom_denied_message, $lang->fc_custom_denied_message_desc, $form->generate_text_area("settings[customdenied]", $customdeniedvalue));
$form_container->output_row($lang->fc_limitusage, $lang->fc_limitusage_desc, $form->generate_numeric_field("settings[limitusage]", $limitusagevalue));
$form_container->output_row($lang->fc_status." <em>*</em>", $lang->fc_status_desc, $form->generate_yes_no_radio("active", $formcreator->active));
$form_container->end();
The other warnings can be removed using a similar method to above except for:
Warning 15 and 16 can be removed by checking if in the admin cp (as the $theme variable doesn't exist in admin cp) $dbicon['path'] = str_replace("{theme}", $theme['imgdir'], $dbicon['path']);
becomes $dbicon['path'] = !defined('IN_ADMINCP') ? str_replace("{theme}", $theme['imgdir'], $dbicon['path']) : $dbicon['path'];
Warning 22 is due to a typo where $lang->fc_lang_width_desc, should be $lang->fc_label_width_desc,
I haven't done many tests with these, but I could create a pull request with my changes if you'd like.
The text was updated successfully, but these errors were encountered:
Describe the bug
When setting up the form, this warning is thrown:
On the "View Form" Tab:
On the "Create Form" Tab, Prior to the "Create a New Form" block:
On the "Create Form" Tab, After the "Create a New Form" block:
(The above 3 warnings are repeated multiple times)
After the "Process Options" block
(Note that some of the later line numbers won't line up as I was debugging the code, but in general they occurred whenever $formcreator->setting['somevalue'] appears)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No PHP warning. These don't impact the functionality, the warnings are largely annoying and make error logging tedious.
Desktop (please complete the following information):
Possible fix(s):
Warning 1:
I changed the line in question from:
if ($mybb->input['page']) {
to
if (isset($mybb->input['page'])) {
and that seemed to resolve the warning.
Warning 2-4:
I replaced the set code for the allowed gid types with:
Warning 5-7
I replaced the following lines:
The other warnings can be removed using a similar method to above except for:
Warning 15 and 16 can be removed by checking if in the admin cp (as the $theme variable doesn't exist in admin cp)
$dbicon['path'] = str_replace("{theme}", $theme['imgdir'], $dbicon['path']);
becomes
$dbicon['path'] = !defined('IN_ADMINCP') ? str_replace("{theme}", $theme['imgdir'], $dbicon['path']) : $dbicon['path'];
Warning 22 is due to a typo where
$lang->fc_lang_width_desc,
should be$lang->fc_label_width_desc,
I haven't done many tests with these, but I could create a pull request with my changes if you'd like.
The text was updated successfully, but these errors were encountered: