Conversation
supportHi, I can no more send emails because of this fatal error, can you fix ASAP please? AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: array_merge(): Argument #2 must be of type array, bool given in /var/www/wp-content/plugins/easy-wp-smtp/src/Admin/Pages/TestTab.php:130 WordPress Version 6.9.4 Easy WP SMTP Version 2.14.0 PHP 8.2.31 Regards This topic was modified 5 days, 7 hours ago by Klemart3D .
Hi @klemart3d , Thanks for reaching out, and I am so sorry to hear about the trouble. I was unable to replicate the issue and I can confirm that there is no bug at the location you shared. It looks like, your DB option got corrupted somehow. Please delete the option with name “easy_wp_smtp_test_email” from your wp_options table, and try again and see how it goes. I hope this helps. Thanks 🙂
Hi @shawon001 , I fixed it by updating the code of the display() function in TestTab.php like this: $stored_test_email_options = get_option( 'easy_wp_smtp_test_email', [] ); if ( ! is_array( $stored_test_email_options ) ) { $stored_test_email_options = []; } $test_email_options = array_merge( [ 'to' => '', 'subject' => '', 'message' => '', ], $stored_test_email_options ); if ( empty( $test_email_options['to'] ) ) { $test_email_options['to'] = wp_get_current_user()->user_email; } Since, no more Fatal error
Hi @klemart3d , Thanks for sharing the workaround. I’ve checked this further with the team, and this workaround will work till next update. So at that time this fix will be overwritten, and the error will surface again. To avoid such scenarios, I’d recommend deleting the option with name “easy_wp_smtp_test_email” from your wp_options table, and try again, and see how it goes as I suggested above. Thanks!
Hi @klemart3d , Thanks for reaching out, and I am so sorry to hear about the trouble. I was unable to replicate the issue and I can confirm that there is no bug at the location you shared. It looks like, your DB option got corrupted somehow. Please delete the option with name “easy_wp_smtp_test_email” from your wp_options table, and try again and see how it goes. I hope this helps. Thanks 🙂
Hi @shawon001 , I fixed it by updating the code of the display() function in TestTab.php like this: $stored_test_email_options = get_option( 'easy_wp_smtp_test_email', [] ); if ( ! is_array( $stored_test_email_options ) ) { $stored_test_email_options = []; } $test_email_options = array_merge( [ 'to' => '', 'subject' => '', 'message' => '', ], $stored_test_email_options ); if ( empty( $test_email_options['to'] ) ) { $test_email_options['to'] = wp_get_current_user()->user_email; } Since, no more Fatal error
Hi @klemart3d , Thanks for sharing the workaround. I’ve checked this further with the team, and this workaround will work till next update. So at that time this fix will be overwritten, and the error will surface again. To avoid such scenarios, I’d recommend deleting the option with name “easy_wp_smtp_test_email” from your wp_options table, and try again, and see how it goes as I suggested above. Thanks!