• Resolved nlanneau

    (@nlanneau)


    After a page timeout I cannot use the Lists page anymore as it shows a critical error notice. Also emails are no longer editable as the page is not loading correctly due to the lists error.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support jaysupport

    (@jaysupport)

    Hi nlanneau,

    Could you please enable WordPress’s?debug?mode and log (https://www.ads-software.com/support/article/debugging-in-wordpress/) and then make the error happen again? Does it give a more descriptive error this time (hopefully with reference to a specific file and line number)? Could you also check the log to see if there are any entries related to/at the time the error occurred, and forward that section to us?

    Thread Starter nlanneau

    (@nlanneau)

    [15-Feb-2023 21:54:24 UTC] PHP Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, null given in ../public_html/wp-content/plugins/ultimate-wp-mail/includes/AdminEmailLists.class.php:101
    Stack trace:

    0 ../public_html/wp-includes/class-wp-hook.php(308): ewduwpmAdminEmailLists->show_admin_email_lists_page()

    1 ../public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()

    2 ../public_html/wp-includes/plugin.php(517): WP_Hook->do_action()

    3 ../public_html/wp-admin/admin.php(259): do_action()

    4 ../public_html/wp-admin/edit.php(10): require_once(‘/home/u34708p29…’)

    5 {main}

    thrown in ../public_html/wp-content/plugins/ultimate-wp-mail/includes/AdminEmailLists.class.php on line 101





    [15-Feb-2023 21:54:42 UTC] PHP Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, null given in ../public_html/wp-content/plugins/ultimate-wp-mail/ewd-uwpm-templates/admin-send-mail.php:57
    Stack trace:

    0 ../public_html/wp-content/plugins/ultimate-wp-mail/includes/CustomPostTypes.class.php(329): include()

    1 ../public_html/wp-admin/includes/template.php(1409): ewduwpmCustomPostTypes->add_send_mail()

    2 ../public_html/wp-admin/edit-form-advanced.php(681): do_meta_boxes()

    3 ../public_html/wp-admin/post.php(206): require(‘/home/u34708p29…’)

    4 {main}

    thrown in ../public_html/wp-content/plugins/ultimate-wp-mail/ewd-uwpm-templates/admin-send-mail.php on line 57

    I’m not a dev on the plugin so try this at your own risk.

    It might be a php version issue if the server version has been “upgraded” recently.

    If you’re comfortable editing php files, you could try the following:

    In the file: /public_html/wp-content/plugins/ultimate-wp-mail/ewd-uwpm-templates/admin-send-mail.php on line 57, change…

    <?php echo esc_html( $list->name ); ?> ( <?php echo sizeOf( $list->user_list ) . ' ' . __(' Users', 'ultimate-wp-mail'); ?> )

    to…

    <?php echo esc_html( $list->name ); ?> ( <?php echo (is_array($list->user_list) ? sizeOf( $list->user_list ) : '0') . ' ' . __(' Users', 'ultimate-wp-mail'); ?> )

    if it is php version related, there may be other array sizeof/count issues elsewhere but you won’t know until you get past this error

    good luck

    Plugin Support jaysupport

    (@jaysupport)

    Thanks for sharing that suggestion @jasemcnotty

    @nlanneau What version of PHP are you using, and did you just switch?

    Thread Starter nlanneau

    (@nlanneau)

    We’re running at 8.1 for the moment

    sizeof() is an alias for count()

    in php version 8+ count/sizeof will throw an error (rather than a warning as in ver 7 or below ) if it’s passed the wrong parameter type.. ie, if the parameter is null or not an array or countable object and that’s probably what’s causing the problem

    https://www.php.net/manual/en/function.count.php#refsect1-function.count-changelog

    anywhere that uses count or sizeof should check to see if the thing being counted is an array before you try to count it.. eg:

    // anywhere you see count() you can substitute for sizeof()
    
    // example existing code
    echo count($myarray);
    
    // php version 7+ change to 
    if(is_countable($myarray)) {
        echo count(myarray);
    }
    
    // any php version but you know you're expecting an array specifically
    if(is_array($myarray)) {
        echo count($myarray);
    }
    
    // you can use shorthand if/else but only if there's an else, eg
    echo (is_countable($myarray) ? count($myarray) : '');
    Thread Starter nlanneau

    (@nlanneau)

    I can confirm it works again with php 7.4

    Plugin Support jaysupport

    (@jaysupport)

    We’ve made some changes in the same vein as what was suggested by jase (thanks for that!) that should correct the issue you were getting when using PHP 8. Since we were never able to recreate the issue, would you be able to test our update to see if it corrects the issue for you? You can download the modified version of the plugin here:

    https://www.etoilewebdesign.com/downloads/uwpm/1.1.3b/ultimate-wp-mail.zip

    Plugin Support jaysupport

    (@jaysupport)

    Did you have the chance to test this?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Critical error on Lists page’ is closed to new replies.