• Using PHP 8.1, we get these PHP errors:

    PHP Warning: Attempt to read property "ID" on null in */wp-content/plugins/pagerestrict/pagerestrict.php on line 155
    */wp-content/plugins/pagerestrict/pagerestrict.php on line 163

    We are using latest version of the plugin.

    Both are fixed by changing line 152 of the pagerestrict.php file from

    if ( !\is_user_logged_in() && $pr_check ) :

    to

    if ( !\is_user_logged_in() && $pr_check && !is_null($post) ) :

    I hope this fix gets rolled out soon since PHP 7 is nearing its end of life and a lot of people will be changing to PHP8 soon. (January 1st, 2023)

    • This topic was modified 2 years, 3 months ago by slramela.
Viewing 1 replies (of 1 total)
  • I think this is the same for me, except client is on PHP 8.0.

    Critical error:
    PHP Notice: Trying to get property ‘ID’ of non-object in /*/httpdocs/wp-content/plugins/pagerestrict/pagerestrict.php on line 155

Viewing 1 replies (of 1 total)
  • The topic ‘PHP 8.1 causing errors’ is closed to new replies.