• Resolved Prismil

    (@prismil)


    Hello,
    thank you for this awesome plugin!
    I get a fatal error when using the tool Move sources to trash.
    Can you please help me to debug? thank you

    Fatal error: Uncaught Error: Using $this when not in object context in /home/customer/www/mysite/public_html/wp-content/plugins/broken-link-checker/includes/any-post.php:839 Stack trace: #0 /home/customer/www/mysite/public_html/wp-content/plugins/broken-link-checker/modules/containers/custom_field.php(658): blcAnyPostContainerManager::ui_bulk_trash_message(7) #1 /home/customer/www/mysite/public_html/wp-content/plugins/broken-link-checker/includes/containers.php(950): blcPostMetaManager->ui_bulk_trash_message(7) #2 /home/customer/www/mysite/public_html/wp-content/plugins/broken-link-checker/core/core.php(2290): blcContainerHelper::ui_bulk_trash_message(‘custom_field’, 7) #3 /home/customer/www/mysite/public_html/wp-content/plugins/broken-link-checker/core/core.php(1751): wsBrokenLinkChecker->do_bulk_delete_sources(Array, false) #4 /home/customer/www/mysite/public_html/wp-includes/class-wp-hook.php(307): wsBrokenLinkChecker->links_page(”) #5 /home/customer/www/mysite/public_html/wp-includes/class in /home/customer/www/mysite/public_html/wp-content/plugins/broken-link-checker/includes/any-post.php on line 839

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @prismil

    I hope you’re well today!

    I wasn’t able to replicate this on my test site and I don’t see any similar issues reported in our internal bug tracking so we’ll need to do a bit of “digging” to find out what’s happening.

    The error refers to a “container” which is, in this case, a “content type” (as in “post type” like post, page, product etc or a comment and so on). Basically, all that you can see under “Look for links in” option on “Settings -> Link Checker” page -> Look for links in” tab.

    The error means that the function at

    /home/customer/www/mysite/public_html/wp-content/plugins/broken-link-checker/includes/any-post.php:839

    didn’t get “object” type data as a function argument as expected. It probably got either some null value or incorrectly formatted value. That in turn means that there’s either some issue with that value stored in DB or something “went wrong”.

    To start with, could you try this?:

    – enable all the checkboxes under “Look for links in” option on the “Settings -> Link Checker” page -> “Look for links in” page
    – then clear all cache on site and server
    – and try again

    If this doesn’t help, would you be able to take a look into the DB (e.g. via phpMyAdmin)? If so, please look for the table wp_blc_instances and try to find those links there then see what’s the value of “container_type” for that. Is it empty or is it formatted in some “weird” way rather than just plain text like “post”, “page”, “comment” or similar?

    Also, what’s the PHP version that’s powering your site?

    Kind regards,
    Adam

    Thread Starter Prismil

    (@prismil)

    Hello Adam,
    thank you so much for your reply and sorry for my late reply!
    I have tried to enable all the checkboxes, cleared the cache and tried again. I had the same issue.
    I had a look at the table wp_blc_instances and all looks good. My container type is “custom_field”. All values in the table are goods.
    I have noticed that the sources of the broken links are moved to trash after I get the error message. But they are still in the dashboard like they have not been moved.
    My PHP version is PHP 7.4.30.
    Thanks again for your help!

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @prismil

    Thank you for the information.

    I tested in PHP 7.4 but couldn’t replicate this either, can you confirm if you are trying to Bulk move to trash or trying a specific link/source?

    If you are trying to do a bulk action, can you try to do it in single actions to see if makes any difference?

    Best Regards
    Patrick Freitas

    Thread Starter Prismil

    (@prismil)

    Hello Patrick,
    thank you so much for your reply!
    Single actions are working well, it seems that the bulk action is the issue.

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @prismil

    Thank you for response and confirmation!

    I looked into the code again and also tried to replicate it again – but to no luck, I’m afraid.

    However, I asked our developers to give it a look. I’d rather not make promises yet but I believe they’ll be able to either find solution or at least help us narrow down the issue and/or suggest further testing.

    Note that their response time may be a bit longer than ours here on forum as they are dealing with a lot of complex tasks on daily basis. But we’ll update you here as soon as we get more information from them on the issue.

    Best regards,
    Adam

    Thread Starter Prismil

    (@prismil)

    Hello Adam,
    thank you so much,
    I look forward to hear from you.

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @prismil

    I just got feedback from our developers.

    Ultimately, they were able to replicate this (and now I was able too) and narrow it down to specific case.

    I was actually quite close saying that it’s related to “container” but I wasn’t able to pinpoint the exact culprit but we know now:

    This is happening due to custom fields check. Specifically, if plugin is set to check custom fields and has fields specified (in “Look for links in” settings) and has option to check “Plain text” links enabled (in “Which links to check” settings) and such custom fields actually have some link in them – the issue happens.

    Unfortunately, there’s no hook (filter/action) in plugin code that would let us fix this “ad hoc” via some sort of “hot patch”.

    We’ve already reported marked it as a bug internally but I don’t have an ETA.

    For now, there are two workarounds:

    1) disabling “Custom fields” checkbox in Look for links in” settings would work but note that it will only help if you use “Force re-check” option after that to force plugin “re-discover” and “re-check” all the links;

    the downside is that it will skip any URLs/links that are added in custom fields and won’t check them

    2) or… “embrace it”; I know how it sounds and I’m not quite comfortable suggesting it; but if you need to keep checking URLs in custom fields that would be the only way; the “move source to trash” option works anyway – even with that error thrown it does trash them so at least that is a good thing and if absolutely necessary, it’s fine to just ignore that error for now.

    Kind regards,
    Adam

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @prismil ,

    We haven’t heard from you for a while now, so it looks like you don’t need our assistance anymore.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Fatal Error when trying to Move sources to trash’ is closed to new replies.