• Resolved Jos Klever

    (@josklever)


    After updating PHP 7.4 to 8.0 we noticed warnings in the error log:
    PHP Warning: Attempt to read property "post_type" on int in /.../wp-content/plugins/broken-link-checker/includes/any-post.php on line 348

    The site seems to work still, but it’s probably a small fix you need in the code to make it compatible with PHP 8.0.

    Thanks!

Viewing 3 replies - 16 through 18 (of 18 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @josklever

    Thank you for response!

    I think we got to the point when we know what’s happening and I’m extremely thankful for you that what started as a support ticket kind of turned out into an extensive troubleshooting cooperation.

    This is a huge help for us in making plugin better and uncovered a very important issue.

    At this point, however, we’ll need to take another turn I’m afraid.

    The first thing is that we know now that somehow there’s Astra doing “something” that turns the global post variable from object to integer variable. I’m honestly not sure if this is intentional or not as even though I tried to briefly analyze their code, I didn’t find exact reason for this. Quite likely I just missed something but on the other hand it’s a huge complex code that I’m not familiar inside-out with. Yet, it doesn’t sound quite “right” to me to manipulate post variable that way. I mean – not the global one. It’s fine to do anything with local (or private – as in private class) variable but not global that is crucial part of WordPress core. Perhaps that’s actually the issue on theme end – that somehow what wasn’t meant to be global just “accidentally leaked” to be global. But that’s a guess.

    One way or another, that’s something they should take care of as, as you already noticed, it may cause issues with other plugins too.

    It’s reasonable for any plugin to expect that what is supposed to be a global variable containing certain type of data (post object in this case) will contain that kind of data.

    But then the second thing comes to play which would be our code. You are right, we should be doing the type check at this point and, in this context, it is to some degree PHP 8 compatibility issue on our end. PHP 8 introduced way more strict error checking. While in BLC the fact that we get a number there instead of object simply causes those related posts on a given page not to be checked and that’s it. They’d still be checked as regular posts anyway. So functionally it doesn’t change much. The difference is that with PHP 8 issue would be reported because of that type difference of post variable. With previous PHP version it may not be reported with typical error reporting configuration in PHP.

    However, this is very specific case and it’s as far as we can go with this. Current version of Broken Link Checker won’t really be further developed and is only kept at the minimum maintenance level.

    Instead our developers are working an a completely new version of the plugin. I’m aware that this was mentioned here and there for quite a long time already but it was a really huge work and will change the way plugin works (technically speaking) completely. In fact, it will make this kind of compatibility issues completely irrelevant as the plugin will literally skan and analyze actual rendered front-end content of the site.

    Thank you again for all the testing, feedback and cooperation with this. I’ll make sure that our developers are made aware of this case. As for the fix, we’ll need to wait for the new major release of Broken Link Checker (unless Astra fixes the issue on their end) as due to how it will work, it will sort this kind of compatibility issues automatically.

    Kind regards,
    Adam

    Thread Starter Jos Klever

    (@josklever)

    Hi Adam,

    Thank you very much for the time you (and your colleagues) took to help investigate this, even though it’s something related to another product. Others would simply point to the other party. ??

    I’ll let it up to your dev team if they want to fix the type checking in case there will be another maintenance release before the new major version will be released (is there an ETA?)

    In the meantime I will create a support topic for Astra pointing to this one and hopefully they can continue the investigation at their end.

    All the best!
    Jos

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @josklever

    You are welcome, we always try to go above and beyond whenever we can.

    We don’t have the Estimated time to release the new engine but we are working hard to make that happen as soon as possible.

    Feel free to contact Astra support, they would be able to give you some extra information about their code.

    Best Regards
    Patrick Freitas

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Warnings in error log with PHP 8.0’ is closed to new replies.