[Resolved] Is Generatepress compatible with PHP8?

Home Forums Support [Resolved] Is Generatepress compatible with PHP8?

Home Forums Support Is Generatepress compatible with PHP8?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2237123
    Tom

    Is Generatepress compatible with PHP 8?

    I’m running GP pro on a local dev server using PHP8 and I’m seeing the following error message in the dashboard “add plugin” screen, when using GP pro as the theme:

    Warning: Undefined property: stdClass::$plugin in D:\dev\www\testsite\wp-includes\class-wp-list-util.php on line 167

    For reference, line 167 is:

    $newlist[ $key ] = $value->$field;

    from this section of code:

    /**
    * Plucks a certain field out of each element in the input array.
    *
    * This has the same functionality and prototype of
    * array_column() (PHP 5.5) but also supports objects.
    *
    * @since 4.7.0
    *
    * @param int|string $field Field to fetch from the object or array.
    * @param int|string $index_key Optional. Field from the element to use as keys for the new array.
    * Default null.
    * @return array Array of found values. If $index_key is set, an array of found values with keys
    * corresponding to $index_key. If $index_key is null, array keys from the original
    * $list will be preserved in the results.
    */
    public function pluck( $field, $index_key = null ) {
    $newlist = array();

    if ( ! $index_key ) {
    /*
    * This is simple. Could at some point wrap array_column()
    * if we knew we had an array of arrays.
    */
    foreach ( $this->output as $key => $value ) {
    if ( is_object( $value ) ) {
    $newlist[ $key ] = $value->$field;
    } else {
    $newlist[ $key ] = $value[ $field ];
    }
    }

    $this->output = $newlist;

    return $this->output;
    }

    The issue doesn’t occur with the WP 2020 or 2021 themes, and all plugins have turned off, and no caching is in operation.

    Thanks for your help.

    #2237688
    David
    Staff
    Customer Support

    Hi there,

    haven’t see that before and i cannot replicate it on my dev servers running PHP 8.0.0 on WP 6.0 with wp_debug enabled.

    But i did find theres an open bug on WP core trac:

    https://core.trac.wordpress.org/ticket/44582

    its quite an old bug by the looks of it, so i don’t think its related to 8.0 but more like an issue in the WP Transients.

    Can you confirm which versions of WP and PHP ?

    #2237725
    Tom

    Thanks for the outstanding support!

    The functions code snippet at the end of the link you sent fixed the issue, which turned out to be a reminder popup on the wp-admin plugins dashboard left behind by a deleted plugin.

    #2237751
    David
    Staff
    Customer Support

    Awesome – glad to be of help!

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