• Resolved Eder Ribeiro

    (@ribeiroeder)


    I found this error repeated hundreds of times in my error_log.

    [24-Aug-2022 14:04:37 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, bool given in /home/XXX/public_html/wp-content/plugins/presto-player/inc/Integrations/LearnDash/LearnDash.php on line 184

    [24-Aug-2022 14:04:37 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, bool given in /home/XXX/public_html/wp-content/plugins/presto-player/inc/Integrations/LearnDash/LearnDash.php on line 185

    ———–

    How to reproduce:

    Just clone the database from the old site and rename the domain to a new site.
    Ex: Rename olddomain.com to newdomain.com

    Your error_log will always trigger this error on newdomain.com

    ———–

    This is a procedure that I do frequently because I have an official site/domain and another clone site/domain just for testing.

    thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello Eder,

    Based on what you described, I suspect there may have been an issue during the migration.

    It looks like the code it is trying to retrieve an option from the wp_options table, but it’s being passed as a boolean instead of an array.

    Firstly, try temporarily switching to another theme, like default themes like – Twenty-Twenty or Twenty-Nineteen, and check if the error or issue persists.

    Next, you can deactivate all the plugins temporarily and see if that solves the error. If it does, activate plugins one by one to see which plugin is causing the problem.

    Thread Starter Eder Ribeiro

    (@ribeiroeder)

    Hello @paulam11

    I had already done all these tests but the error persisted.

    So that I could solve it, it was necessary to edit lines 184/185 to confirm that it is an array:

    if (is_array($saved)) {
        $key = array_key_exists('sfwd-lessons_lesson_video_url', $saved) ? 'sfwd-lessons_lesson_video_url' : '';
        $key = array_key_exists('sfwd-topic_lesson_video_url', $saved) ? 'sfwd-topic_lesson_video_url' : $key;
    }

    Could you pass on to the team responsible for programming? This check does not modify the function, it just guarantees to pass a valid array before array_key_exists.

    thanks.

    Plugin Author Andre Gagnon

    (@2winfactor)

    Thanks! We’ll get this fixed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Warning: array_key_exists() expects parameter 2 to be array’ is closed to new replies.