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
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):
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