• Resolved Gevorg

    (@gev0rg)


    Hello

    After having posted about the PHP fatal error issue, here is another PHP warning issue which occurs in the same file called WPPostService.php.

    Again…
    we have PHP v8.2.28 running on the web-server.
    WordPress v6.8.1 is installed.
    The FS Poster plugin is installed as version 7.1.9

    This is the PHP warning hat occurred:

    [04-May-2025 21:53:54 UTC] PHP Warning:  Attempt to read property "post_status" on null in /home/customer/www/trike-bike.com.au/public_html/wp-content/plugins/fs-poster/App/Providers/WPPost/WPPostService.php on line 128

    It happens within the function called:
    public static function postUpdated ( $wpPostId, $postAfter, $postBefore )

    If either $postAfter or $postBefore is null then trying to get ->post_status from null will not work, and it causes the mentioned PHP warning; it happens here:
    $postStatusChanged = ScheduleService::getScheduleStatusByWpPostStatus( $postBefore->post_status ) != ScheduleService::getScheduleStatusByWpPostStatus( $postAfter->post_status );

    I applied this solution within the function:
    if ($postAfter === null || $postBefore === null) return;

    If either one is null the rest of the function is not executed.

    You can make your own consideration if this solution works with your plugin. One way or the other, you should take precaution for the case when $postAfter or $postBefore can be null.

    This topic is not a question. If you think this solution works with your plugin you can mark this topic as solved.

    If you update your plugin with a solution to avoid this problem it will be appreciated.

    Sincerely,
    Gevorg

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author fscode

    (@fscode)

    Hi there!

    Here is not meant for providing support for the Pro version.

    We would like to have an opportunity to investigate your feedback further. Could you create a support ticket at https://support.fs-code.com or contact us via email at info@fs-poster.com please? We’ll work with you to resolve any issues as quickly as possible.

    Best Regards,

    FS Poster Team

    Thread Starter Gevorg

    (@gev0rg)

    I am not asking for any support, I am trying to help you solve a problem. I posted a solution for you.

    Just read the topic, or forward it to someone who can read English, and let your team examine the solution I have posted here for you.

    Sincerely,
    Gevorg

    Plugin Author fscode

    (@fscode)

    Thanks for your feedback.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘PHP Warning … Attempt to read property “post_status” on null [Solved?]’ is closed to new replies.