• Resolved jaroat

    (@jaroat)


    Hi!
    The plugin (version 2.6.18) threw an error on activation in a newly set up multisite (but I believe it can also throw the error on a normal installation) on a PHP 8.4 host.

    Caused by src/Upgrade/Ver2.php:

    The lines
    $role = get_role( 'auto_listings_seller' );
    $remove = array_keys( $role->capabilities );


    throw an error since get_role returnes null on a fresh install (the queried role is not present yet) and array_keys awaits an array as parameter.

    You should be safe if you insert the following line in between:

    if ( empty( $role ) ) { return; }

    resulting in

    $role = get_role( 'auto_listings_seller' );
    if ( empty( $role ) ) { return; }
    $remove = array_keys( $role->capabilities );

    • This topic was modified 6 months, 1 week ago by jaroat. Reason: better formatting, more precise
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP Error on Activation’ is closed to new replies.