• Resolved PWS

    (@perceptionweb)


    After updating to Live Chat 8.1.1 a PHP warning is displayed on front end pages from the plugin functions.php file, line 1851, indicating parameter 2 of the in_array function is expecting an array, but received a string. This happens in performing a check of the wplc_exclude_post_types setting. Trying to change ‘Exclude chat window on selected post types’ under General Settings produces a fatal error.

    The following code fixes the warning on the front end:

    
    function pws_fix_wplc_settings () {
        $wplc_settings = get_option('WPLC_SETTINGS');
        if ( isset($wplc_settings['wplc_exclude_post_types'])
            && ! is_array($wplc_settings['wplc_exclude_post_types'])
        ) {
            $wplc_settings['wplc_exclude_post_types'] = array();
            update_option('WPLC_SETTINGS', $wplc_settings);    
        }
    }
    add_action('init', 'pws_fix_wplc_settings', 10, 0);
    

    However, the default setting is an empty string which still causes a fatal error when saving the settings: Fatal error: Uncaught Error: [] operator not supported for strings in wp-live-chat-support.php on line 3640. The default setting should probably be changed to an empty array.

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

    (@wordpress3cx)

    Hello, thanks for your detailed feedback. This is a bug and will be fixed ASAP. Stay tuned for next release.
    You’ll get a notice when this is fixed.

    Plugin Author wordpress3cx

    (@wordpress3cx)

    This issue is fixed in new version 8.1.2. Let us know!

    Thread Starter PWS

    (@perceptionweb)

    It’s working now. Thanks for the quick update.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP warning about passing string, expected array’ is closed to new replies.