Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCF is not accounting for multiple defaults #73

Open
evolluti0n opened this issue Jan 10, 2019 · 0 comments
Open

CCF is not accounting for multiple defaults #73

evolluti0n opened this issue Jan 10, 2019 · 0 comments

Comments

@evolluti0n
Copy link

What Was The Original Issue?
Hey guys, just wanted to give a heads up on a bug I found on the Connected Caldera Forms plugin. After you guys introduced the ability to set multiple defaults for a radio / checkbox / select field, if I use that along with CCF, after I submit a form, I might get this error: "Warning: strpos() expects parameter 1 to be string, array given in (...)wp-content\plugins\cf-connected-forms\includes\calcdefaults.php on line 87". This happens because CCF is not accounting for multiple defaults. But I think it's an easy fix. Here's how I fixed (an updated version of the function responsible for the bug):

/**
* Check if a value is a '{prev:}' magic tag
*
* @since 1.2.2
*
* @param string $test
*
* @return bool
*/
protected static function is_prev_magic( $test ){
if( is_array( $test ) ) {
foreach( $test as $test_value ) {
if( 0 === strpos( $test_value, '{prev:' ) ) {
return true;
}
}
return false;
} else {
return 0 === strpos( $test, '{prev:' );
}
}

Hope this helps to get this bug fixed!

What add-on(s) Does This Related To?
Connected Caldera Forms plugin version 1.2.2

What version of PHP, Caldera Forms and WordPress
WordPress Version
4.9.8
PHP Version
5.6
Caldera Forms Version
1.7.4
Add-on Version
1.2.2

What Are The Relevant Errors?
Warning: strpos() expects parameter 1 to be string, array given in (...)\wp-content\plugins\cf-connected-forms\includes\calcdefaults.php on line 87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant