• Resolved Bjarne Oldrup

    (@oldrup)


    Hey!

    Nothing critical, but just a heads up. I get these warnings when testing Easy Fancybox with WP 6.6 RC 1 and PHP 8.3


    Warning: Undefined array key "autoAttributeLimit" in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 132

    Warning: Trying to access array offset on null in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 132

    Warning: Undefined array key "autoAttributeLimit" in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 132

    Warning: Trying to access array offset on null in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 132

    Warning: Undefined array key "autoSelector" in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 156

    Warning: Trying to access array offset on null in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 156

    Warning: Undefined array key "autoGallery" in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 184

    Warning: Trying to access array offset on null in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 184

    Warning: Undefined array key "autoGallery" in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 184

    Warning: Trying to access array offset on null in /home/sustain2/oldrup.net/wp-content/plugins/easy-fancybox/inc/fancybox-2.php on line 184

    WP_DEBUG on.

    Lightboxes still work.

    Is that something you can reproduce?

    Bjarne

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author FirelightWP

    (@firelightwp)

    @oldrup – Hi and thanks for the report.

    I’m not able duplicate your issue out of the box. And the code in question hasn’t changed in a long time. But all those warnings are inside one conditional block of code. It seems based on your settings you’ve found a way to trigger that block of code in a situation where some of the supporting options aren’t there.

    I will play with this today to see if I can duplicate. If so, I’ll prep a fix. If not, at the very least, I can put some extra precautionary checks to confirm the relevant array keys in those warnings are set before using them.

    I’ll follow up once I know more.

    Plugin Author FirelightWP

    (@firelightwp)

    Hi again,

    So I understand why you’re getting this message, but I don’t understand how your site got in a state to product it. I want to review in case you might know how you produced it.

    Here’s the context:

    For each content type (image, pdf, video, etc), you can enable or disable autodetection. For everything but images, the only way to set this is via check box. So by default, it is either true or false (or more accurately 1 or 0).

    For images, you can actually set an array of extensions like ‘.jpg,.png’.

    In the code, we treat these situations differently. We check if the value of this setting is numeric (1 or 0). If so we know we’re dealing with non-images and proceed. Otherwise, if the value is a string value that is not numeric (ie, a list of file extensions), we know we’re dealing with images, and we proceed based on that.

    Somehow your site is in a situation where, for non-images, you have something other than 1 or 0. Again, those values should always be 1 of 0 because they’re based on check boxes. We don’t present any settings or interface that would allow it to be set otherwise.

    The question

    Given all that, do you have any idea how you might have ended up in that situation? I’m not sure if you’ve tried to customize the plugin by setting custom file extensions for detecting videos or pdfs or other non-image content?

    Quick possible fix effort

    One way we might be able to fix this is to have you do the following:

    • Go to lightbox settings
    • One that page, in the top section for Enable, uncheck all the boxes. In effect you are disabling autodetection for all content types. Then save.
    • Then you can immediately re-check any boxes you want, and save again. Theoretically, when you update those checkboxes and save, the values in the database should get updated to the right values.

    Could you try that and let me know if it works?

    Alternative fix with concerns

    I mentioned in my first response I can add a check to ensure that if the values aren’t expected, we don’t run the corresponding code. In your case, this would remove the warnings. BUT… because you have an unexpected value stored for a checkbox, the plugin may still not behave quite right for you.

    Thanks.

    Thread Starter Bjarne Oldrup

    (@oldrup)

    Oh wow, that is some serious diagnostics you’ve done there. Thank you.

    No, I cannot say how I got here, but this is a VERY old website I keep updating early, specifically to locate and iron out any issues regarding new WordPress and PHP releases.

    So. Yes, I can definitely try and disable every all file types, click save, and enable them again.

    And yes, it appears to solve the issue. On the test site, there are 4 different kinds of embeds; single images, galleries, YouTube videos (got Ricked?), and a PDF.

    https://oldrup.net/easy-fancybox/

    And I’m pleased to report, that after the suggested settings refresh, they all work perfectly fine.

    To return the thorough diagnostics, I also checked with all 3 free light box scrips, Fancy Box Legacy, Reloaded and V2. All good. ?

    Tested with WP 6.6 RC1, PHP 8.3, debug and error console enabled.

    Thanks again!
    Bjarne

    Plugin Author FirelightWP

    (@firelightwp)

    Great! Glad it’s resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.