• Resolved fabien79

    (@fabien79)


    Hello,

    it crashed my WP on the widget page.
    here the logs :

    WordPress version 5.9.1
    Extension actuelle : Widget for Social Page Feeds (version 6.1)
    PHP version 8.0.16
    
    Détails de l’erreur
    ======================
    Une erreur de type E_ERROR a été causée dans la ligne 142 du fichier /home/misspaga/public_html/wp-content/plugins/facebook-pagelike-widget/fb_class.php. Message d’erreur : Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in /home/misspaga/public_html/wp-content/plugins/facebook-pagelike-widget/fb_class.php:142
    Stack trace:
    #0 /home/misspaga/public_html/wp-content/plugins/facebook-pagelike-widget/fb_class.php(142): in_array()
    #1 /home/misspaga/public_html/wp-includes/class-wp-widget.php(534): facebook_widget->form()
    #2 /home/misspaga/public_html/wp-admin/includes/widgets.php(274): WP_Widget->form_callback()
    #3 /home/misspaga/public_html/wp-admin/includes/widgets.php(60): wp_widget_control()
    #4 /home/misspaga/public_html/wp-admin/widgets-form.php(436): wp_list_widgets()
    #5 /home/misspaga/public_html/wp-admin/widgets.php(34): require('...')
    #6 {main}
      thrown

    Thanks

    • This topic was modified 2 years, 9 months ago by fabien79.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi
    i have the same issue on php 7.4.3 and 8.0/8.1
    working fine in my test enviroment running PHP 7.4.27 (cant be updated, so i cant test the later version from the live environment)

    Hi
    i had the same issue on php 8.0 I cahnged to php 7.4 and every thing goes well really thank you ??
    and sorry for my miss writing in english
    Bruno

    If you need to fix it, open the plugin file fb_class.php, around lines 139 is where it breaks.

    in_array( $tab, $select) ? ‘selected=”selected”‘ : ”, the $selected may be defined as a string. I changed it to the below and it works. I don’t know if it’s the referred solution of the plugin author, but it gets you by until a fix is released.

    $tabs = array( 'timeline','events','messages' );
                foreach( $tabs as $tab )
                {
                    if ( is_array($select) ) {
                        printf(
                            '<option value="%s" class="hot-topic" %s style="margin-bottom:3px;">%s</option>',
                            $tab,
                            in_array( $tab, $select) ? 'selected="selected"' : '',
                            $tab
                        );
                    } else {
                        printf(
                            '<option value="%s" class="hot-topic" %s style="margin-bottom:3px;">%s</option>',
                            $tab,
                            $select ? 'selected="selected"' : '',
                            $tab
                        );
                    }
                }

    @srsimonson Thanks for the code fix I can confirm it works in php8.0 now.

    Plugin Author Milap

    (@milap)

    Hello All,

    I apologies for delayed response. I just fixed above issue and updated plugin version to 6.2.

    Kindly update and let me know if issue still persists.

    Kind Regards, Milap

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Crash on PHP8’ is closed to new replies.