PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V3.3.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV3.3.2
V3.3.2 3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 All 139 releases
← All changes | includes/Frontend/Form/View/Theme/Fields/HtmlSelectField.php +12 -5 3.1.1 → V3.3.2 View file →
@@ -19,9 +19,9 @@
19 19 if (isset($opt->val) && $opt->val === $val) {
20 20 $selected = 'selected';
21 21 } elseif (isset($opt->lbl) && $opt->lbl === $val) {
22 22 $selected = 'selected';
23 - } elseif (property_exists($opt, 'check')) {
23 + } elseif (is_object($opt) && property_exists($opt, 'check')) {
24 24 $selected = 'selected';
25 25 }
26 26 return $selected;
27 27 }
@@ -61,10 +61,13 @@
61 61 $fieldHelpers->kses_post($field->ph)
62 62 );
63 63 }
64 64
65 - if (property_exists($field, 'opt')) {
65 + if (property_exists($field, 'opt') && is_iterable($field->opt)) {
66 66 foreach ($field->opt as $opt) {
67 + if (!is_object($opt)) {
68 + continue;
69 + }
67 70 $disabled = property_exists($opt, 'disabled') ? 'disabled' : '';
68 71 if (property_exists($opt, 'type')) {
69 72 $optionsHTML .= sprintf(
70 73 '<optgroup
@@ -78,10 +81,14 @@
78 81 $fieldHelpers->getCustomClasses('slct-opt-grp'),
79 82 $fieldHelpers->esc_attr($opt->title),
80 83 $disabled
81 84 );
82 - foreach ($opt->childs as $child) {
83 - $val = isset($child->val) ? $child->val : $child->lbl;
85 + $optChilds = isset($opt->childs) && is_iterable($opt->childs) ? $opt->childs : [];
86 + foreach ($optChilds as $child) {
87 + if (!is_object($child)) {
88 + continue;
89 + }
90 + $val = isset($child->val) ? $child->val : ($child->lbl ?? '');
84 91 $selected = self::checkSelected($child, $value);
85 92 $disabled = property_exists($child, 'disabled') ? 'disabled' : '';
86 93 $optionsHTML .= sprintf(
87 94 '<option
@@ -104,9 +111,9 @@
104 111 }
105 112 $optionsHTML .= '</optgroup>';
106 113 } else {
107 114 $selected = self::checkSelected($opt, $value);
108 - $val = isset($opt->val) ? $opt->val : $opt->lbl;
115 + $val = isset($opt->val) ? $opt->val : ($opt->lbl ?? '');
109 116 $optionsHTML .= sprintf(
110 117 '<option
111 118 %1$s
112 119 class="%2$s %3$s"