Skip to:
Content
Pages
Categories
Search
Top
Bottom

500: post_status no array


  • tweichart
    Participant

    @tweichart

    Hey guys,

    I get a 500 error after the latest update:

    
    AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /var/www/vhosts/<url>/wp-content/plugins/bbpress/includes/forums/functions.php:1800
    Stack trace:
    #0 /var/www/vhosts/<url>/wp-includes/class-wp-hook.php(298): bbp_pre_get_posts_normalize_forum_visibility(Object(WP_Query))
    #1 /var/www/vhosts/<url>/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
    #2 /var/www/vhosts/<url>/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
    #3 /var/www/vhosts/<url>/wp-includes/class-wp-query.php(1681): do_action_ref_array('pre_get_posts', Array)
    #4 /var/www/vhosts/<url>/wp-includes/class-wp-query.php(3238): WP_Query->get_posts()
    #5 /var/www/vhosts<url>/wp-includes/class-wp.php(617): WP_Query->query(Array)
    #6 /var/www/vhosts/<url>/wp-includes/clas...'
    

    ln 1800 looks like this:

    
    $post_stati = $posts_query->get( 'post_status' );
    
    // Default to public status
    if ( empty( $post_stati ) ) {
        $post_stati[] = bbp_get_public_status_id();
    
    // Split the status string
    } elseif ( is_string( $post_stati ) ) {
        $post_stati = explode( ',', $post_stati );
    }
    

    could be fixed by forcing the array:

    
    $post_stati = $posts_query->get( 'post_status' );
    if (!is_array($post_stati)){
        $post_stati = array($post_stati);
    }
    
    // Default to public status
    if ( empty( $post_stati ) ) {
        $post_stati[] = bbp_get_public_status_id();
    
    // Split the status string
    } elseif ( is_string( $post_stati ) ) {
        $post_stati = explode( ',', $post_stati );
    }
    

    side note: wp version 4.7.4, bbpress version 2.5.12

    Thanks in advance,
    Toby

Viewing 3 replies - 1 through 3 (of 3 total)

  • Robin W
    Moderator

    @robin-w

    Suspect you are using php 7.1

    so 3 fixes
    1. downgrade to a lesser version of php
    2. upgrade to bbpress 2.6beta-2
    3. in bbpress 2.5.12 change line 1851 from
    $meta_query = $posts_query->get( ‘meta_query’ );
    to
    $meta_query = $posts_query->get( ‘meta_query’, array() );
    Since the next upgrade will fix that anyway, no issue in changing the bbpress file
    best I can offer I’m afraid


    Barry
    Participant

    @barryhughes-1

    I find it just a little disconcerting that this problem has been in the wild – stopping, for example, new users of the plugin from being able to set anything up – for almost 6 months now …


    Robin W
    Moderator

    @robin-w

    2.5.13 will apparently be release shortly that will fix this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar