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/Conversational/Fields/HtmlSelectField.php +12 -5 -3.0.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 }
@@ -60,10 +60,13 @@
60 60 $fieldHelpers->kses_post($field->ph)
61 61 );
62 62 }
63 63
64 - if (property_exists($field, 'opt')) {
64 + if (property_exists($field, 'opt') && is_iterable($field->opt)) {
65 65 foreach ($field->opt as $opt) {
66 + if (!is_object($opt)) {
67 + continue;
68 + }
66 69 $disabled = property_exists($opt, 'disabled') ? 'disabled' : '';
67 70 if (property_exists($opt, 'type')) {
68 71 $optionsHTML .= sprintf(
69 72 '<optgroup
@@ -76,10 +79,14 @@
76 79 $fieldHelpers->getConversationalCls('slct-opt-grp') . ' ' . $fieldHelpers->getCustomClasses('slct-opt-grp'),
77 80 $fieldHelpers->esc_attr($opt->title),
78 81 $disabled
79 82 );
80 - foreach ($opt->childs as $child) {
81 - $val = isset($child->val) ? $child->val : $child->lbl;
83 + $optChilds = isset($opt->childs) && is_iterable($opt->childs) ? $opt->childs : [];
84 + foreach ($optChilds as $child) {
85 + if (!is_object($child)) {
86 + continue;
87 + }
88 + $val = isset($child->val) ? $child->val : ($child->lbl ?? '');
82 89 $selected = self::checkSelected($child, $value);
83 90 $disabled = property_exists($child, 'disabled') ? 'disabled' : '';
84 91 $optionsHTML .= sprintf(
85 92 '<option
@@ -101,9 +108,9 @@
101 108 }
102 109 $optionsHTML .= '</optgroup>';
103 110 } else {
104 111 $selected = self::checkSelected($opt, $value);
105 - $val = isset($opt->val) ? $opt->val : $opt->lbl;
112 + $val = isset($opt->val) ? $opt->val : ($opt->lbl ?? '');
106 113 $optionsHTML .= sprintf(
107 114 '<option
108 115 %1$s
109 116 class="%2$s"