• Resolved skylex69

    (@skylex69)


    Hi,

    If you edit any post and add a W4 Post List shortcode with an ID to a nonexistent list, like this [postlist id=999999] you get a fatal error in PHP 8.* resulting in an error page: There has been a critical error on this website.

    Here’s the error: Uncaught exception (TypeError): “Cannot access offset of type string on string“ at ./[...]/plugins/w4-post-list/includes/shortcodes/class-list-shortcode.php:58.

    It’s critical because if someone adds a postlist shortcode in some posts and later on deletes the related list and forgets to remove the shortcode in all old posts, those posts will be broken.

    This error also pops-up regularly in my error log of wp-cron tasks because of W4PL shortcodes to removed lists in old posts.

    You can easily fix this by adding this check before line 58 of plugins/w4-post-list/includes/shortcodes/class-list-shortcode.php :
    if (is_array($options))

    I believe this is related to breaking changes introduced in PHP 8: https://www.php.net/manual/en/migration80.incompatible.php

    I hope you can fix the plugin soon.

    Thanks and best regards,

    • This topic was modified 1 year, 7 months ago by skylex69.
    • This topic was modified 1 year, 7 months ago by skylex69.
    • This topic was modified 1 year, 7 months ago by skylex69.
    • This topic was modified 1 year, 7 months ago by skylex69.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Fatal error on PHP 8 with nonexistent list ID’ is closed to new replies.