Skip to content

Commit

Permalink
If $form is null in Caldera_Forms_Magic::field_magic set it to be an …
Browse files Browse the repository at this point in the history
…empty array.

That prevents option labels that use magic tags to break entry viewer.
  • Loading branch information
New0 committed May 20, 2019
1 parent d31cd57 commit 0483c88
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 0483c88

Please sign in to comment.