• Resolved Fixmysite

    (@newtlabs)


    Hi,

    We encountered a fatal error when saving settings in the plugin under PHP 8.x.

    Error message:

    Fatal error: Uncaught TypeError: array_diff(): Argument #1 ($array) must be of type array, false given in /wp-content/plugins/searchpro/inc/helper-functions.php on line 1592

    The issue occurs inside the function:

    bwp_is_option_updated()

    Specifically this line:

    return !empty(array_diff($option_val, $urls_array));

    In some cases get_option($option_name) returns false (likely when the option does not yet exist), which causes array_diff() to throw a TypeError in PHP 8+.

    As a temporary fix, we changed the line to:

    return !empty(array_diff(is_array($option_val) ? $option_val : [], $urls_array));

    This prevents the fatal error and ensures compatibility with PHP 8.

    It may be worth updating the plugin to validate that $option_val is always an array before calling array_diff() to avoid breaking admin pages under newer PHP versions.

    Environment:

    • WordPress: Latest
    • PHP: 8.x
    • Plugin version: 3.1.17

    Hope this helps.

Viewing 1 replies (of 1 total)
  • Plugin Author Hamza Mairaj

    (@thevisionofhamza)

    Hey there,

    Thanks for reporting the bug. We’ve added a fix in the latest version (v3.1.18).

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.