• janvitos

    (@janvitos)


    Hi,

    I’ve been using your plugin for a while, and it’s really awesome.

    Though, we’ve recently upgraded from PHP 5.4 to PHP 7.1, and postfilter does not work anymore.

    Although there are no error messages thrown, the specified post using postfilter is simply not removed from returned posts and all posts are returned as if postfilter was not used.

    Our exact same code used to work just fine before upgrading.

    I’ve also made sure that the correct post ID is provided to postfilter.

    Is there anything else I could do to help you debug this problem?

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter janvitos

    (@janvitos)

    OK, I found what’s not working, and fixed it temporarily.

    Changing “true” to “false” on line 437 from class-ga-top-content.php fixed the issue.

    Change

    if ( in_array( absint( $post->ID ), $postfilters, true ) ) {

    To

    if ( in_array( absint( $post->ID ), $postfilters, false ) ) {

    Not sure why this was working before on PHP 5.4.

    Plugin Author Justin Sternberg

    (@jtsternberg)

    what about if you update line 435 from:

    
    $postfilters = array_map( 'trim', array_map( 'absint', explode( ',', esc_attr( $atts['postfilter'] ) ) ) );
    

    to:

    
    $postfilters = array_map( 'absint', explode( ',', esc_attr( $atts['postfilter'] ) ) );
    

    Does it work then? I don’t really want to remove the in_array strict check.

    Thread Starter janvitos

    (@janvitos)

    I changed “false” back to “true” on line 437, changed line 435 to what you posted and cleared transients, and it works!

    • This reply was modified 8 years ago by janvitos.
    Plugin Author Justin Sternberg

    (@jtsternberg)

    Ok, perfect. Will update. Thank you for reporting back to me! For now, leave yours as-is, because the next update will add that in.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Postfilter not working since upgrading to PHP 7.1’ is closed to new replies.