PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmField.php +14 -3 6.31 → trunk View file →
@@ -79,8 +79,12 @@
79 79 'credit_card' => array(
80 80 'name' => __( 'Payment', 'formidable' ),
81 81 'icon' => 'frmfont frm_credit_card2_icon',
82 82 ),
83 + 'address' => array(
84 + 'name' => __( 'Address', 'formidable' ),
85 + 'icon' => 'frmfont frm_location2_icon',
86 + ),
83 87 FrmSubmitHelper::FIELD_TYPE => array(
84 88 'name' => __( 'Submit', 'formidable' ),
85 89 'hide' => true,
86 90 ),
@@ -438,8 +442,9 @@
438 442 unset( $pro_fields['credit_card'] );
439 443 unset( $pro_fields['product'] );
440 444 unset( $pro_fields['quantity'] );
441 445 unset( $pro_fields['total'] );
446 + unset( $pro_fields['address'] );
442 447 }
443 448
444 449 /**
445 450 * @since 4.0
@@ -472,13 +477,19 @@
472 477 $new_values[ $col ] = $values[ $col ];
473 478 }
474 479 }
475 480
476 - $new_values['options'] = self::maybe_filter_options( $values['options'] );
481 + // Both option columns are stored serialized, but they do not accept the same shapes.
482 + // Choice fields pass options already serialized, as does FrmFieldsHelper::fill_field
483 + // when a field is duplicated, and fields with no choices pass an empty string, so a
484 + // missing key is the only thing worth defaulting. An is_array check here would throw
485 + // every one of those defaults away. field_options is always an array, so anything
486 + // else is invalid input, and replacing it stops consumers getting null.
487 + $new_values['options'] = self::maybe_filter_options( $values['options'] ?? array() );
477 488 $new_values['field_order'] = isset( $values['field_order'] ) ? (int) $values['field_order'] : null;
478 489 $new_values['required'] = isset( $values['required'] ) ? (int) $values['required'] : 0;
479 490 $new_values['form_id'] = isset( $values['form_id'] ) ? (int) $values['form_id'] : null;
480 - $new_values['field_options'] = $values['field_options'];
491 + $new_values['field_options'] = isset( $values['field_options'] ) && is_array( $values['field_options'] ) ? $values['field_options'] : array();
481 492 $new_values['created_at'] = current_time( 'mysql', 1 );
482 493
483 494 if ( isset( $values['id'] ) ) {
484 495 $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key'];
@@ -521,9 +532,9 @@
521 532 * See FrmAppHelper::allow_unfiltered_html.
522 533 *
523 534 * @since 5.0.08
524 535 *
525 - * @param array $options
536 + * @param array|string $options Already serialized for choice fields, and an empty string for fields with no choices.
526 537 *
527 538 * @return array
528 539 */
529 540 private static function maybe_filter_options( $options ) {