Support » Plugin: SchedulePress (a.k.a. WP Scheduled Posts) - Missed Schedule, Auto Social Share & Best Editorial Calendar » PHP8: PHP Fatal error: Uncaught TypeError: method_exists()

  • Resolved misterfu

    (@misterfu)


    With PHP8 I get the following error:

    PHP Fatal error: Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in /(…)/wp-content/plugins/wp-scheduled-posts/includes/Email.php:43

    I’m aware PHP8 is not yet officially supported, but maybe you could look into this? Thank you!

    I *believe* (not tested!) this could fix it:

    - if (\method_exists($current_screen, 'is_block_editor')) {
    + if ((is_string($current_screen) || is_object($current_screen)) && \method_exists($current_screen, 'is_block_editor')) {

Viewing 5 replies - 1 through 5 (of 5 total)
  • Rasel

    (@arrasel403)

    Hi @misterfu,

    Sorry for the inconvenience caused. Need to check this issue. For further investigation please create a support ticket through this link: https://wpdeveloper.net/support/new-ticket/

    Our Technical Support team will get back to you. Thank you.

    Plugin Support rafinkhan

    (@rafinkhan)

    @misterfu,

    Hi, there. When exactly are you seeing this error by the way?

    I have just tried this on a Fresh Setup on PHP 8.0 actually and didn’t get this error. So, maybe i am missing something. Can you please share a bit more details on how to reproduce this?

    And, yes, we are not yet fully compatible with PHP 8.0. But still not getting this error though.

    Besides, instead of updating the plugin, can you please delete it and install it freshly on your site & let me know how it goes?

    For further investigation, you can also contact our support team through the link provided above.

    Thank you!

    Thread Starter misterfu

    (@misterfu)

    Thanks @rafinkhan – I discovered this when I upgraded the plugin from an old version to the most recent one. After I have re-installed it from scratch I could not longer see the error.

    Plugin Support rafinkhan

    (@rafinkhan)

    Hi @misterfu,

    Glad to know that your issue is all sorted out now. Cheers!

    Have a nice day!

    Thread Starter misterfu

    (@misterfu)

    Hi @rafinkhan – sorry, error appears again. Very strange, it’s now happening every time when I’m editing a post and then try to save it.

    But hey… at least it’s now reproducible and I can confirm that manually applying this change fixed it:

    - if (\method_exists($current_screen, 'is_block_editor')) {
    + if ((\is_string($current_screen) || \is_object($current_screen)) && \method_exists($current_screen, 'is_block_editor')) {
    • This reply was modified 1 month, 2 weeks ago by misterfu.
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.