• Our server was updated to newer versions of PHP and WP recently and I found that I was unable to Save Draft for a new sermon. The error was:

    WordPress version 5.9.2
    Current theme: High Responsive Child (version 1.0.0)
    Current plugin: Sermon Manager for WordPress (version 2.16.8)
    PHP version 8.0.16

    Error Details
    =============
    An error of type E_ERROR was caused in line 232 of the file /…/public_html/wp-content/plugins/sermon-manager-for-wordpress/includes/class-sm-dates-wp.php. Error message: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /…/public_html/wp-content/plugins/sermon-manager-for-wordpress/includes/class-sm-dates-wp.php:232
    Stack trace:
    #0 /…/public_html/wp-content/plugins/sermon-manager-for-wordpress/includes/class-sm-dates-wp.php(201): SM_Dates_WP::update_term_dates(‘wpfc_service_ty…’, Array)
    #1 /…/public_html/wp-includes/class-wp-hook.php(307): SM_Dates_WP::save_terms_dates(10821, Object(WP_Post), true)
    #2 /…/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #3 /…/public_html/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
    #4 /…/public_html/wp-includes/post.php(4676): do_action(‘save_post_wpfc_…’, 10821, Object(WP_Post), true)
    #5 /…/public_html/wp-includes/post.php(4789): wp_insert_post(Array, false, true)
    #6 /…/public_html/wp-admin/includes/post.php(426): wp_update_post(Array)
    #7 /…/public_html/wp-admin/post.php(227): edit_post()
    #8 {main}
    thrown`

    I was able to resolve this issue by changing sermon-manager-for-wordpress/includes/class-sm-dates-wp.php. as follows:

    232c232
    < if (count($the_terms)>1) {

    > if (is_countable($the_terms) && count($the_terms)>1) {

    Also I noticed in the error_log file had this warning:

    PHP Fatal error: Unparenthesizeda ? b : c ? d : eis not supported. Use either(a ? b : c) ? d : eora ? b : (c ? d : e)` in /…/public_html/wp-content/plugins/sermon-manager-for-wordpress/views/wpfc-podcast-feed.php on line 165

    sermon-manager-for-wordpress/views/wpfc-podcast-feed.php
    165c165
    < ‘terms’ => is_numeric( $terms ) ? intval( $terms ) : false !== strpos( $terms, ‘,’ ) ? array_map( ‘sanitize_title’, explode( ‘,’, $terms ) ) : sanitize_title( $terms ),

    > ‘terms’ => is_numeric( $terms ) ? intval( $terms ) : ( false !== strpos( $terms, ‘,’ ) ? array_map( ‘sanitize_title’, explode( ‘,’, $terms ) ) : sanitize_title( $terms ) ),

    That seems to have stopped the warnings, too. Hope someone finds this helpful.

Viewing 1 replies (of 1 total)
  • Thread Starter beryrinaldo

    (@beryrinaldo)

    Another issue fixed:

    # diff wp-content/plugins/sermon-manager-for-wordpress/sermons.php.orig wp-content/plugins/sermon-manager-for-wordpress/sermons.php
    627c627
    < if(count($sermons_array)>0){

    > if(is_countable($sermons_array) && count($sermons_array)>0){

Viewing 1 replies (of 1 total)
  • The topic ‘Issues saving with PHP 8.0.16, WP 5.9.2, two fixes’ is closed to new replies.