• Not long after upgrading to PHP 8.1 (from 7.4) I noticed a pair of recurring lines in public_html/error_log. They’ve only recurred about 10 times so far but I thought I’d mention it here in case it’s helpful.

    We’re on the current WordPress, Astra, ELementor, and Elementor Header & Footer Builder. I’m only surmising that it’s an Astra problem since it’s the common denominator, but it could be Elementor.

    Right now I don’t actually know under what conditions they trigger or what the repercussions are, if any.

    `[24-Nov-2022 12:37:17 UTC] PHP Warning: Attempt to read property “post_type” on null in /home/site/public_html/wp-content/plugins/astra-addon/classes/modules/target-rule/class-astra-target-rules-fields.php on line 1375
    [24-Nov-2022 12:37:17 UTC] PHP Warning: Attempt to read property “ID” on null in /home/site/public_html/wp-content/plugins/astra-addon/classes/modules/target-rule/class-astra-target-rules-fields.php on line 1376

    [24-Nov-2022 12:37:17 UTC] PHP Warning: Attempt to read property “post_type” on null in /home/site/public_html/wp-content/plugins/header-footer-elementor/inc/lib/target-rule/class-astra-target-rules-fields.php on line 1324
    [24-Nov-2022 12:37:17 UTC] PHP Warning: Attempt to read property “ID” on null in /home/site/public_html/wp-content/plugins/header-footer-elementor/inc/lib/target-rule/class-astra-target-rules-fields.php on line 1325`

Viewing 15 replies - 1 through 15 (of 18 total)
  • Hi @bjf2000,

    Astra is not yet fully compatible with PHP 8.1. I would suggest you to use PHP 7.4.X or PHP 8.0 instead.

    Just FYI, even WordPress is not fully compatible with PHP 8.0 or 8.1, as mentioned in this post.

    I hope it will help.

    Kind regards,
    Herman 😊

    Thread Starter bjf2000

    (@bjf2000)

    @bsfherman That article, from the beginning of the year, was regarding 5.9 though. We’re at 6.1 now, and AFAIK it is onboard with PHP through 8.1.

    But either way, what do you think is the meaning of the warnings? Normal PHP chatter or important?

    Hi @bjf2000,

    Could you please let us know the steps to replicate this? So far, the messages we got, it’s just the deprecated warning and doesn’t brake the site.

    Looking forward to hearing from you.

    Kind regards,
    Herman 😊

    Thread Starter bjf2000

    (@bjf2000)

    I didn’t say that it breaks the site, but I haven’t excluded that it actually causes no problems, either, since it’s impossible to test everything. Unlike the developer, I don’t even know what the purpose of the files in question are, so you’re in a much better position to answer the question of relevance.

    Even if irrelevant, it’s better to fix a problem than having messages stack up like this in the log (and they definitely are stacking up) indefinitely.

    Are you saying that you see the notices too, and is Elementor involved, as seems to be implied based on what I showed? If you’re not even using Elementor on your test site, then we know it’s not. I can’t test without Elementor being there.

    Also, to clarify, I wouldn’t necessarily say that these even are deprecation notices in the first place, since the words “PHP Deprecated” are traditionally used for those.

    Thread Starter bjf2000

    (@bjf2000)

    Thoughts, comments?

    Hi @bjf2000,

    Our team is working on the compatibility with PHP 8.1. If you are able to share with us the steps to replicate this, it would be very helpful.

    Kind regards,
    Herman 😊

    Thread Starter bjf2000

    (@bjf2000)

    AFAIK, it’s simply having PHP 8.1.x.

    It would be very helpful on your end if you could tell me whether or not you’re seeing the issue. If you’re not, and as I mentioned, it MAY require having Elementor.

    Hi,

    I am using PHP 8.1.10 on my local, however, I don’t have any error message in PHP error log. I have Elementor installed and activated too. I am using Laragon for local server. That’s why I asked you the steps to replicate this, in case you are aware of a specific thing you did before you got the error message above.

    Kind regards,
    Herman 😊

    Thread Starter bjf2000

    (@bjf2000)

    If I figure that out, I’ll post back, but I haven’t yet. It’s something in the ordinary use of the site though: either creating or modifying content. Our people aren’t doing anything beyond that.

    I would suggest adding the “Elementor Header & Footer Builder” plugin, since it could definitely be wrapped up in this given its apparent connection with class-astra-target-rules-fields.php.

    If possible, you might also update to PHP 8.1.13, which is what we have.

    Sorry for the delay.

    That would be very helpful if you can help with test case or steps to replicate this.

    On my dev site, besides the Elementor, I have the Elementor Header & Footer Builder installed and activated too. The only difference that can be “seen” is only the PHP version that is slightly different version.

    Kind regards,
    Herman 🙂

    Thread Starter bjf2000

    (@bjf2000)

    And the log is staying empty despite doing ordinary work on the site, like creating a post and modifying one?

    There are many changes in each rev of PHP despite the version numbers being close. I do recommend updating to 8.1.13 and then we can go from there.

    Hi @bjf2000,

    Very old thread I know. However, are you still having the same error in the log, with the latest version of Astra theme, which is v4.1.5?

    Please let me know.

    Kind regards,
    Herman 😊

    Thread Starter bjf2000

    (@bjf2000)

    Thanks for checking back. Everything involved is current (WP, PHP 8.1, Elemantor, Astra), but they’re still occurring, with one difference:

    Mentions of these seem to have stopped (it was always flurries of both before):

    astra-addon/classes/modules/target-rule/class-astra-target-rules-fields.php

    But these continue:

    header-footer-elementor/inc/lib/target-rule/class-astra-target-rules-fields.php

    I’m not sure why that is, since they occurred at the same times before. It’s not as if they should have had two different causes.

    Hi @bjf2000, thank you for the update.

    The first one, astra-addon is coming from the Astra Pro plugin. Good to know it is no longer triggering any errors.

    For the second one, are you still getting it even only Elementor Header & Footer plugin is the only active plugin?

    Kind regards,
    Herman 😊

    Thread Starter bjf2000

    (@bjf2000)

    When you say “only active plugin” I’m not sure what you mean. There are numerous active plugins, but perhaps you’re referring to things Elementor, meaning that Elementor Header & Footer is the only thing active from the Elementor family. But that’s not true, since Elementor itself is active; I wasn’t even aware that you could use the Header & Footer one without it.

Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘PHP Warning: Attempt to read property’ is closed to new replies.