Skip to content

Commit

Permalink
Merge pull request CalderaWP#3207 from CalderaWP/feature/3167
Browse files Browse the repository at this point in the history
Set $form variable to prevent error with magic tag in labels - Fixes CalderaWP#3167
  • Loading branch information
Josh Pollock authored May 21, 2019
2 parents e58b48d + ab5deae commit 8d87bdc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion classes/magic.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ public function field_magic( $_value, $value, $matches, $entry_id, $form ){

if( ! empty( $matches ) && ! empty( $matches[1] ) && ! empty( $matches[1][0]) ){

if ( Caldera_Forms_Field_Util::has_field_type( 'credit_card_exp', $form ) ) {
//Set default $form value to be an empty array (prevents option labels that use magic tags to break entry viewer)
if ( $form === null ){
$form = array();
}

if ( Caldera_Forms_Field_Util::has_field_type( 'credit_card_exp', $form ) ) {
$split = Caldera_Forms_Magic_Util::split_tags( $matches[1][0] );
if( is_array( $split ) && ! empty( $split[1] ) && in_array( $split[1], array( 'month', 'year' ) ) ){
$field = Caldera_Forms_Field_Util::get_field_by_slug( $split[0], $form );
Expand Down

0 comments on commit 8d87bdc

Please sign in to comment.