Share:
Notifications
Clear all

Bug [Solved] PHP 8 Warnings

4 Posts
2 Users
2 Likes
243 Views
Posts: 2
Topic starter
(@joloco)
New Member
Joined: 4 months ago

Hi,

After upgrading our server to PHP 8, we are getting a lot of Warnings in the logs. These aren't causing bugs for users, but our logs are being flooded!

The main culprit is this one:

PHP Warning:  Undefined array key "guest_can_comment" in /site/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php on line 1731

but there's also this one:

PHP Warning:  Undefined array key "show_subscription_bar" in /site/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php on line 218

Both of these weren't an issue in PHP 7, but PHP 8 is a little stricter about these things.

The simplest solution is to wrap these checks in

!empty()

so that, for example, line 218 would become:

$isSubscriptionBarEnabled = ! empty( $this->generalOptions["show_subscription_bar"] );
3 Replies
Asti
Posts: 6975
 Asti
Support
(@asti)
Illustrious Member
Joined: 6 years ago

We'll check and get back to you soon.

2 Replies
Asti
 Asti
Support
(@asti)
Joined: 6 years ago

Illustrious Member
Posts: 6975

The issue will be fixed in the next version of the wpDiscuz plugin.

(@joloco)
Joined: 4 months ago

New Member
Posts: 2

That's great, thank you @asti !

Share: