caseproof / members

Members WordPress plugin.
GNU General Public License v2.0
78 stars 35 forks source link

PHP 8.2 compatibility #106

Closed jrswgtr closed 1 year ago

jrswgtr commented 1 year ago

Problem

As of now there are several deprecation notices when using PHP 8.2.

PHP Deprecated: Creation of dynamic property Members\Admin\Settings_Page::$admin_pages is deprecated in /wp-content/plugins/members/admin/class-settings.php on line 222 PHP Deprecated: Creation of dynamic property Members\Admin\Settings_Page::$addons_page is deprecated in /wp-content/plugins/members/admin/class-settings.php on line 225 PHP Deprecated: Creation of dynamic property Members\Admin\Settings_Page::$payments_page is deprecated in /wp-content/plugins/members/admin/class-settings.php on line 228 PHP Deprecated: Creation of dynamic property Members\Admin\Settings_Page::$about_page is deprecated in /wp-content/plugins/members/admin/class-settings.php on line 231

Solution

Declare the properties in the Settings_Page class.

final class Settings_Page {

    public array $admin_pages;

    public string $addons_page;

    public string $payments_page;

    public string $about_page;

    // ...............
}
cartpauj commented 1 year ago

Thanks for the report.

This should have been resolved in https://github.com/caseproof/members/pull/105

We'll be getting a release out soon with the fix.

For now closing as a duplicate.