• Resolved Bowo

    (@qriouslad)


    Hi,

    My debug log is showing this error:

    “in_array() expects parameter 2 to be array, string given”

    …which happens during execution of /includes/youtube-api.php at:

    // Store data in transients
    if ( $transient_expiration > 0 ) {            
        set_transient( $transient_key, $data, $transient_expiration );
    
        // Get the current list of transients
        $transient_keys = get_option( 'ayg_transient_keys', array() );
    
        // Append our new one
        if ( ! in_array( $transient_key, $transient_keys ) ) {
            $transient_keys[] = $transient_key;
        }
    
        // Save it to the DB
        update_option( 'ayg_transient_keys', $transient_keys );
    }

    Is it a problem with the API key?… or something else?

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Bowo

    (@qriouslad)

    If I check in the wp_options table, ayg_transient_keys key has no value in it.

    Thread Starter Bowo

    (@qriouslad)

    Additionally, before checking the wp_options table, I cleared the cache via plugin setting… which may explain the empty value for the ayg_transient_keys key?

    Plugin Contributor wpvideogallery

    (@wpvideogallery)

    @qriouslad,

    Thanks for bringing this issue to us.

    I have taken a note of this now and I promise that our next version would have this issue addressed.

    Yes, the issue occurs when the cache is cleared and the “ayg_transient_keys” option goes empty.

    As an immediate solution, kindly edit open the /includes/youtube-api.php file,

    Find the line below,
    $transient_keys = get_option( 'ayg_transient_keys', array() );

    Change it as,

    $transient_keys = get_option( 'ayg_transient_keys', array() );
    if ( ! is_array( $transient_keys ) ) {
        $transient_keys = (array) $transient_keys;
    }

    Save the changes and check now.

    Hope this solved your issue!

    Thread Starter Bowo

    (@qriouslad)

    Thank you! Yes, that solved it. Have a great day!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘“in_array() expects parameter 2 to be array, string given”’ is closed to new replies.