Geoff Martyn

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
in reply to: Advanced Access Control #200465

Geoff Martyn
Participant

Hi Nayeem,

Apologies for the delayed reply on this. The issue is described above. Using the add-on at all with PHP 8 will result in this error. The suggested change to the code should work to address this, however your developer should be able to apply this and test it to ensure it doesn’t have a knock-on effect anywhere else.

Kind regards,

Geoff

in reply to: Advanced Access Control #200307

Geoff Martyn
Participant

Hi Nayeem,

I’ve disabled debug mode and get I still get a critical error. It’s nothing to do with the error being displayed, it’s more to do with the variable not being initialised and then called.

Adding the code in above where I initialise the variable before it’s called, fixes the issue.

As far as I can tell, this is due to PHP 8 being stricter in how it handles undefined variables and error reporting. Suppressing the error does not affect the critical failire, resulting in the page not displaying.

I’m not sure I can be any clearer.

Kind regards,

Geoff

in reply to: Advanced Access Control #200302

Geoff Martyn
Participant

Hi Nayeem,

From digging around a bit further, it looks like the variable $categories is being used in /plugins/wpdm-advanced-access-control/tpls/wpdm-my-downloads-wlt.php prior to being initialised or defined, which is being flagged by the stricter error reporting in PHP 8, and suppressing the error still causes the page to throw a critical error.

Obviously, I don’t want to edit the plugin code directly, but if I do this in a staging environment, by adding a line before to check whether $categories is defined and is not null, then it looks like it fixes the issue.

<?php 

        /* Check variable is not undefined or null */ 
        $categories = $categories ?? [];

        if(is_array($categories) && count($categories) > 0){ ?>
            <div class="col-md-3">

Would it be possible to test this and look to action this amendment in the next version if it works?

Thank you

Geoff

in reply to: Advanced Access Control #200301

Geoff Martyn
Participant

Hi Nayeem,

I’m very well thank you and hope you’re well too.

Thank you for your reply. The debug mode is on, but that’s in order to find out what the error is as without debug set to true, the error is simply, “There has been a critical error on this website”. Setting debug to true gives me the above error. If I disable the advance access control add-on, the site operates as normal although the shortcode just appears in place.

Thank you

Geoff

Viewing 4 posts - 1 through 4 (of 4 total)