Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1046928

    Hi there,

    When using WordPress 5+, Enfold and WooCommerce memberships it will throw a fatal error when editing WooCommerce > Memberships

    I’m pretty sure this is an Enfold specific incompatibility as other sites running WooCommerce Memberships and WordPress 5+ doesn’t have this Fatal Error.

    Here’s the debug output
    Fatal error: Uncaught TypeError: Argument 1 passed to Avia_Gutenberg::handler_display_post_states() must be of the type array, string given, called in /var/www/DOMAIN.COM.CLOAKED/public_html/wp-includes/class-wp-hook.php on line 286 and defined in /var/www/DOMAIN.COM.CLOAKED/public_html/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php:366 Stack trace: #0 /var/www/DOMAIN.COM.CLOAKED/public_html/wp-includes/class-wp-hook.php(286): Avia_Gutenberg->handler_display_post_states('', Object(WP_Post)) #1 /var/www/DOMAIN.COM.CLOAKED/public_html/wp-includes/plugin.php(203): WP_Hook->apply_filters('', Array) #2 /var/www/DOMAIN.COM.CLOAKED/public_html/wp-admin/includes/template.php(1933): apply_filters('display_post_st...', Array, Object(WP_Post)) #3 /var/www/DOMAIN.COM.CLOAKED/public_html/wp-admin/includes/class-wp-posts-list-table.php(943): _post_states(Object(WP_Post)) #4 /var/www/DOMAIN.COM.CLOAKED/public_html/wp-admin/includes/class-wp-posts-list-table.php(857): WP_Posts_List_Table->column_title(Object(WP_Post)) #5 /var/www/p in /var/www/DOMAIN.COM.CLOAKED/public_html/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php on line 366

    The error happens because /enfold/config-gutenberg/class-avia-gutenberg.php on line 366 this function
    public function handler_display_post_states( array $post_states, WP_Post $post )

    Assums that $post_states is always an array, which it iisn’t nessecarily, it can also be a string.

    It should be changed to
    public function handler_display_post_states( $post_states, WP_Post $post )

    Then in the same file on line 382 it is assumed again to be an array

    $key = array_search( 'Gutenberg', $post_states );
    					if( false !== $key )
    					{
    						unset( $post_states[ $key ] );
    					}

    It should be changed to check if it’s actually an array

    if( is_array($post_states ) ) {
    					$key = array_search( 'Gutenberg', $post_states );
    					if( false !== $key )
    					{
    						unset( $post_states[ $key ] );
    					}
    				}

    Kind Regard
    Yan Knudtskov

    #1048141

    Hey yanknudtskov,

    Thank you for using Enfold.

    I think the site is still running on an old version of the theme because that code is no longer positioned on that line. The latest version 4.5.2 contains additional Gutenberg compatibility fixes.

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.