Support » Fixing WordPress » Undefined array key 3807

  • Good morning,
    yesterday I was alerted by jetpack that my site went down briefly for around 20 minutes.
    When it was back every page of the website is listed with the same error repeated multiple times

    Warning: Undefined array key 3807 in /homepages/24/d4296231672/htdocs/wordpress/wp-includes/nav-menu-template.php on line 210

    I completed some updates, tried disabling plugins and then re installed 6.1.

    I then removed all but the very basic plugins and I’m still not anywhere near a fix.

    
    ### wp-core ###
    
    version: 6.1
    site_language: en_GB
    user_language: en_GB
    timezone: UTC
    permalink: /%postname%/
    https_status: true
    multisite: false
    user_registration: 1
    blog_public: 1
    default_comment_status: open
    environment_type: production
    user_count: 41
    dotorg_communication: true
    
    ### wp-paths-sizes ###
    
    wordpress_path: /homepages/24/d4296231672/htdocs/wordpress
    wordpress_size: loading...
    uploads_path: /homepages/24/d4296231672/htdocs/wordpress/wp-content/uploads
    uploads_size: loading...
    themes_path: /homepages/24/d4296231672/htdocs/wordpress/wp-content/themes
    themes_size: loading...
    plugins_path: /homepages/24/d4296231672/htdocs/wordpress/wp-content/plugins
    plugins_size: loading...
    database_size: loading...
    total_size: loading...
    
    ### wp-dropins (1) ###
    
    advanced-cache.php: true
    
    ### wp-active-theme ###
    
    name: Storefront (storefront)
    version: 4.1.3
    author: Automattic
    author_website: https://woocommerce.com/
    parent_theme: none
    theme_features: core-block-patterns, widgets-block-editor, post-thumbnails, automatic-feed-links, custom-logo, menus, html5, custom-background, custom-header, site-logo, title-tag, customize-selective-refresh-widgets, wp-block-styles, align-wide, editor-styles, editor-font-sizes, editor-style, responsive-embeds, amp, woocommerce, wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider, starter-content, widgets, infinite-scroll
    theme_path: /homepages/24/d4296231672/htdocs/wordpress/wp-content/themes/storefront
    auto_update: Enabled
    
    ### wp-themes-inactive (3) ###
    
    Twenty Twenty: version: 2.1, author: the WordPress team, Auto-updates enabled
    Twenty Twenty-One: version: 1.7, author: the WordPress team, Auto-updates enabled
    Twenty Twenty-Two: version: 1.3, author: the WordPress team, Auto-updates enabled
    
    ### wp-plugins-active (18) ###
    
    Advanced Dynamic Pricing for WooCommerce: version: 4.1.6, author: AlgolPlus, Auto-updates enabled
    Back In Stock Notifier for WooCommerce | WooCommerce Waitlist Pro: version: 3.0, author: codewoogeek, Auto-updates enabled
    CookieYes | GDPR Cookie Consent: version: 3.0.4, author: CookieYes, Auto-updates enabled
    Fasthosts Assistant: version: 8.4.0, author: Fasthosts, Auto-updates enabled
    Google Listings and Ads: version: 2.2.0, author: WooCommerce, Auto-updates enabled
    Jetpack: version: 11.5.1, author: Automattic, Auto-updates enabled
    MailPoet: version: 3.102.1, author: MailPoet, Auto-updates enabled
    MailPoet Premium: version: 3.102.0, author: MailPoet, Auto-updates enabled
    myStickymenu: version: 2.6.1, author: Premio, Auto-updates enabled
    One Time Login: version: 0.3.1, author: Daniel Bachhuber, Auto-updates enabled
    StoreCustomizer: version: 2.4.4, author: Kaira, Auto-updates enabled
    Website Open/Closed Toggle: version: 0.3.8, author: RS, Auto-updates enabled
    Wish List for WooCommerce: version: 1.8.9, author: Thanks to IT, Auto-updates enabled
    WooCommerce: version: 7.0.1, author: Automattic, Auto-updates enabled
    WooCommerce Blocks: version: 8.8.2, author: Automattic, Auto-updates enabled
    WooCommerce PayPal Payments: version: 1.9.5, author: WooCommerce, Auto-updates enabled
    WooCommerce Weight Based Shipping: version: 5.3.25, author: weightbasedshipping.com, Auto-updates enabled
    WP Super Cache: version: 1.9.1, author: Automattic, Auto-updates enabled
    
    ### wp-plugins-inactive (4) ###
    
    Clearpay Gateway for WooCommerce: version: 3.5.0, author: Clearpay, Auto-updates enabled
    Facebook for WooCommerce: version: 2.6.28, author: Facebook, Auto-updates enabled
    Product Import Export for WooCommerce: version: 2.2.5, author: WebToffee, Auto-updates enabled
    Visual Term Description Editor: version: 1.8.1, author: Shea Bunge, Auto-updates enabled
    
    ### wp-media ###
    
    image_editor: WP_Image_Editor_GD
    imagick_module_version: Not available
    imagemagick_version: Not available
    imagick_version: Not available
    file_uploads: File uploads is turned off
    post_max_size: 64M
    upload_max_filesize: 64M
    max_effective_size: 64 MB
    max_file_uploads: 20
    gd_version: 2.2.5
    gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM
    ghostscript_version: 9.27
    
    ### wp-server ###
    
    server_architecture: Linux 4.4.302-icpu-088 x86_64
    httpd_software: Apache
    php_version: 8.0.25 64bit
    php_sapi: cgi-fcgi
    max_input_variables: 5000
    time_limit: 50000
    memory_limit: -1
    max_input_time: -1
    upload_max_filesize: 64M
    php_post_max_size: 64M
    curl_version: 7.64.0 OpenSSL/1.1.1n
    suhosin: false
    imagick_availability: false
    pretty_permalinks: true
    htaccess_extra_rules: true
    
    ### wp-database ###
    
    extension: mysqli
    server_version: 10.5.17-MariaDB-1:10.5.17+maria~deb10-log
    client_version: mysqlnd 8.0.25
    max_allowed_packet: 67108864
    max_connections: 3000
    
    ### wp-constants ###
    
    WP_HOME: undefined
    WP_SITEURL: undefined
    WP_CONTENT_DIR: /homepages/24/d4296231672/htdocs/wordpress/wp-content
    WP_PLUGIN_DIR: /homepages/24/d4296231672/htdocs/wordpress/wp-content/plugins
    WP_MEMORY_LIMIT: 40M
    WP_MAX_MEMORY_LIMIT: -1
    WP_DEBUG: false
    WP_DEBUG_DISPLAY: true
    WP_DEBUG_LOG: false
    SCRIPT_DEBUG: false
    WP_CACHE: true
    CONCATENATE_SCRIPTS: undefined
    COMPRESS_SCRIPTS: undefined
    COMPRESS_CSS: undefined
    WP_ENVIRONMENT_TYPE: Undefined
    DB_CHARSET: utf8
    DB_COLLATE: undefined
    
    ### wp-filesystem ###
    
    wordpress: writable
    wp-content: writable
    uploads: writable
    plugins: writable
    themes: writable
    
    ### jetpack ###
    
    site_id: 202517603
    ssl_cert: No
    time_diff: undefined
    version_option: 11.5.1:1667484187
    old_version: 11.5:1667398080
    public: Public
    master_user: #1 cantraig_candles
    current_user: #1 cantraig_candles
    tokens_set: Blog User
    blog_token: T4pLRewHUmSVdFYRzdgTLz5C%F!MW*q8
    user_token: qG3K!YdJ(eg@MkDC)XTQBs9&1@xd1d($
    version: 11.5.1
    jp_plugin_dir: /homepages/24/d4296231672/htdocs/wordpress/wp-content/plugins/jetpack/
    plan: free
    protect_header: {"trusted_header":"REMOTE_ADDR","segments":1,"reverse":false}
    full_sync: {"started":"Sat, 05 Feb 2022 14:12:51 +0000","finished":"Sat, 05 Feb 2022 14:12:55 +0000","progress":{"options":{"finished":true},"functions":{"finished":true},"constants":{"finished":true},"users":{"total":"1","sent":1,"finished":true,"last_sent":"1"},"network_options":{"finished":true}},"config":{"options":true,"functions":true,"constants":true,"users":[1],"network_options":true}}
    sync_size: undefined
    sync_lag: 0 seconds
    full_sync_size: undefined
    full_sync_lag: 0 seconds
    idc_urls: {"home":"https:\/\/mayburys.uk","siteurl":"https:\/\/mayburys.uk","WP_HOME":"","WP_SITEURL":""}
    idc_error_option: false
    idc_optin: true
    cxn_tests: All Pass.
    
    

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Try downloading WordPress again, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel (consult your hosting provider’s documentation for specifics on these), and delete then replace your copies of everything on the server except the wp-config.php file and the /wp-content/ directory with fresh copies from the download. This will effectively replace all of your core files without damaging your content and settings.

    If you’d like to manually make a backup of your site first, please follow the steps at https://wordpress.org/support/article/wordpress-backups/

    Some uploaders tend to be unreliable when overwriting files, so don’t forget to delete the original files before replacing them.

    If that doesn’t work, try manually resetting your plugins (no Dashboard access required). If that resolves the issue, reactivate each one individually until you find the cause.

    And if that does not resolve the issue, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel (consult your hosting provider’s documentation for specifics on these), navigate to /wp-content/themes/ and rename the directory of your currently active theme. Hopefully, this will force the default theme to activate and rule out a theme-specific issue (theme functions can interfere like plugins).`

    Hello, @cantraig.
    I think that’s a bug. It was introduced about 3 weeks ago.
    In my opinion, it has nothing to do with FTP/SFTP.
    I will alert the developers so they can work on a proper fix.
    Meanwhile, you can edit the src/wp-includes/nav-menu-template.php file and replace this line (line #212):

    
    $menu_item_parent = $menu_items_tree[ $menu_item_key ];
    

    with

    
    $menu_item_parent = isset( $menu_items_tree[ $menu_item_key ] ) ? $menu_items_tree[ $menu_item_key ] : 0;
    

    But please do this at your own risk (and make backups).
    Editing core files is a bad idea, and I’m only providing this code snippet out of a desire to help until a proper fix gets released. I haven’t tested it and I don’t know if it will work.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Please don’t edit the core files.

    This doesn’t match any bugs we’re currently aware of: https://wordpress.org/support/topic/read-this-first-wordpress-6-1/#post-15661769

    And that file in particular also handles theme and plugin functions, suggesting there’s a conflict caused by one of them.

    If you have ruled out third-party conflicts and are absolutely certain this is a bug, please report it properly by following the steps at https://make.wordpress.org/core/handbook/testing/reporting-bugs/ so it can be addressed by the developers.

    Hello, @macmanx.
    Thanks for your reply.
    I’ve already reported it in the original issue where the “bug” was created: https://core.trac.wordpress.org/ticket/28620#comment:34
    I’m inclined to let core committers decide what to do with it.
    Even if it’s a plugin conflict, it must not cause PHP warnings in Core files.
    From my point of view, it’s more about following the rules of “defensive programming” rather than plugin conflicts.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    We could probably handle overall errors better, I agree, but in this case, the right thing to do is for the developer of the conflicting plugin/theme to fix their plugin/theme.

    That fix would then go out to all of the plugin’s/theme’s users as soon as they update (or automatically as we introduced auto-updates for plugins/themes a while back), rather than waiting for a lengthy contributor discussion and inevitable core code refactor.

    the right thing to do is for the developer of the conflicting plugin/theme to fix their plugin/theme.

    It is not known what the cause of this issue is.
    Unfortunately, there are no steps to reproduce the issue.
    The only thing that is clear to me is that the PHP warning is related to the patch I mentioned above.
    It wouldn’t have appeared without the patch.
    From my point of view, the code of the patch must be improved to fix the PHP warning and/or handle it properly.

    @cantraig, here is a suggestion that does not resolve the warning, however it will hide these from visitors to your site while a solution is eventually discovered.

    Temporary Warning Suppression

    According to the config data you’ve provided, it appears you have WP_DEBUG_DISPLAY enabled. I would recommend turning this off, and also disabling PHP’s internal display_errors setting. In your wp-config.php file, here is what to add/modify:


    define( 'WP_DEBUG_DISPLAY', false ); // tell WordPress to hide errors
    ini_set( 'display_errors', 0 ); // tell PHP to hide errors

    Now I WOULD recommend you leave debug logging enabled (WP_DEBUG_LOG) when troubleshooting, so that you know what’s going on behind the scenes. Ignorance is bliss, but only for a short while 😂.

    For more information on debug settings in WordPress, please see this article:

    Debugging in WordPress

    Remediation

    If at all possible, you should copy your production environment into a staging/dev area, and from there disable ALL plugins to see if this warning still shows up. This will go a long way toward giving you peace of mind and knowing the underlying cause.

    If I’m reading the config info correctly, you have 18 enabled plugins (not including your theme) that are potentially modifying the menu data and triggering the warning messages.

    Whether or not you identify that one of the plugins is causing the issue, please report your findings here. Because WordPress 6.1 was just released, this info will either help other users of the plugin, or it could help the entire WordPress community 🙌🏻

    Thread Starter cantraig

    (@cantraig)

    @macmanx thanks for this info.
    I will look into doing what you suggested when I have time to solve anything that may go wrong in the process.
    In the meantime I need to hide the error messages from my website. Since this is being displayed I’m loosing a lot of potential sales.

    I have looked around and saw that I can set WP_DEBUG_DISPLAY to false and expect PHP messages to *never* display on-screen to visitors?

    Is there any risk in doing this? I only feel comfortable adding to css I’ve never gone much further than this before.

    Hi, @cantraig:

    In addition to setting WP_DEBUG_DISPLAY to false, the reason for the ini_set part is that your host may have configured PHP itself to display errors, even if WordPress isn’t. So the intent for these configuration settings in tandem is to prevent any PHP errors appearing on the frontend of the site.

    As with any changes to your site, it is recommended to make a backup first, but an adjustment to wp-config.php like this is fairly common.

    Hi, @cantraig:

    Just following up here — were you able to resolve the errors displaying on the site?

    Thread Starter cantraig

    (@cantraig)

    @ironprogrammer i was not able to get it fixed however when updating to 6.1.1 it fixed the error for me.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.