strangerstudios / pmpro-limit-post-views

Integrates with Paid Memberships Pro to limit the number of times non-members can view posts on your site.
https://www.paidmembershipspro.com/add-ons/pmpro-limit-post-views/
7 stars 19 forks source link

PHP 8 - Warning: Trying to access array offset on value of type bool #48

Closed michaelbeil closed 1 year ago

michaelbeil commented 2 years ago

Describe the bug As reported in ticket 414077 (moderators only), there is an error shown on /wp-admin/admin.php?page=pmpro-limitpostviews with PHP 8.

To Reproduce Steps to reproduce the behavior:

  1. Upgrade to PHP 8
  2. Go to /wp-admin/admin.php?page=pmpro-limitpostviews
  3. Scroll down see error: Warning: Trying to access array offset on value of type bool in /Users/michaelbeil/Local Sites/test/app/public/wp-content/plugins/pmpro-limit-post-views/adminpages/limitpostviews.php on line 36

Screenshot image

Expected behavior There should not be an error shown.

Isolating the problem:

WordPress Environment

``` Paid Memberships Pro 2.7.5, Limit Post Views Add On .6, Twenty Twenty-One 1.4, WordPress 5.9.2, and PHP 7.4.1. ```
michaelbeil commented 2 years ago

Reported in ticket 420731 (moderators only) with PHP 7.4.28.