Consequence: The contact form sometimes work, sometimes not. PHP 8.1 is being used.
I had the same warning on PHP 8.2. I guess line 326 is telling the truth (“this is a real monkey patching”) 🙂
I added some additional checks to line 327, seems to work for me though I didn’t test extensively yet:
$message_list = ( is_array( $additional_settings ) && isset( $additional_settings['message'] ) ) ? sanitize_text_field( implode( ' ', explode( '] [', $additional_settings['message'] ) ) ) : '';
Plugin Author
Erik
(@codekraft)
Hi everyone,
Thanks for reporting this PHP warning issue, I apologize but I just saw this issue today 🥲. I’ve just identified the root cause and have implemented a fix. The warning “Trying to access array offset on value of type bool” was occurring because the cf7a_get_mail_additional_data() function was sometimes returning false instead of an array, but the code was trying to access $additional_settings['message'] without proper validation.
I’ve updated the code to include proper type checking before accessing array elements. The problematic line:
$message_list = sanitize_text_field( implode( ' ', explode( '] [', $additional_settings['message'] ) ) );
Has been replaced with:
$message_list = ( is_array( $additional_settings ) && isset( $additional_settings['message'] ) && is_string( $additional_settings['message'] ) ) ? sanitize_text_field( implode( ' ', explode( '] [', $additional_settings['message'] ) ) ) : '';
Thanks for your patience and for helping identify this issue! the fix will be published tomorrow in the 0.6.4 version