• Resolved KissMyLegs

    (@kissmylegs)


    I recently began getting this error in my error log.
    Any assistance would be greatly appreciated.
    I am running Woocommerce Version:?8.6.1

    [05-Mar-2024 15:25:23 UTC] PHP Warning: Undefined array key “title” in /…/public_html/wp-content/plugins/woocommerce/templates/single-product/tabs/tabs.php on line 38

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter KissMyLegs

    (@kissmylegs)

    I am also seeing this warning popping up:

    [05-Mar-2024 16:11:05 UTC] PHP Warning: Trying to access array offset on value of type bool in /…/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 2691

    Hey there, @kissmylegs! Thanks for contacting us. I’m happy to help you.

    I’d like to understand your site properly. Please share with us the System Status Report which you can find via WooCommerce > Status > Get system report > Copy for support.

    Just to confirm, are you seeing any issues on the website’s front end or just the error messages on the logs?

    Looking forward to your reply.

    Have a wonderful day!

    Thread Starter KissMyLegs

    (@kissmylegs)

    Hi.. I'm only seeing these warnings in my site error logs (in public_html and wp-content). No issues with the site running (that I can tell). These errors were first noted on February 28, 2024. 
    
    My last updates prior to February 28, 2024 were on February 25, 2024 and the plugins that were updated include:
    Google XML Sitemaps Generator (1.8.1 -> 1.8.3)
    SiteOrigins Widgets Bundle (1.58.6 -> 1.58.7)
    WooCommerce (8.6.0 -> 8.6.1)
    
    I have not begun the transition to HPOS and do not suspect this has any bearing on these warnings. I have a test site as well (all plugins and theme are up to date there) and the same warnings are present.
    
    If need be, I can go in to my test environment and start disabling plugins; I cannot do that on my live site though.
    
    I was also seeing errors elsewhere regarding undefined variables. I have gone and corrected those ones as they are outside your plugin. Again, all warnings started (as per log dates) on February 28, 2024. 
    
    Here is the status report:
    
    
    
    
     WordPress Environment
    
    WordPress address (URL): https://kissmylegs.ca
    Site address (URL): https://kissmylegs.ca
    WC Version: 8.6.1
    REST API Version: ? 8.6.1
    WC Blocks Version: ? 11.8.0-dev
    Action Scheduler Version: ? 3.7.1
    Log Directory Writable: ?
    WP Version: 6.4.3
    WP Multisite: –
    WP Memory Limit: 2 GB
    WP Debug Mode: –
    WP Cron: ?
    Language: en_US
    External object cache: – Server Environment
    
    Server Info: Apache
    PHP Version: 8.0.30
    PHP Post Max Size: 2 GB
    PHP Time Limit: 3000
    PHP Max Input Vars: 10000
    cURL Version: 8.6.0
    OpenSSL/1.1.1w
    
    SUHOSIN Installed: –
    MySQL Version: 5.7.23-23
    Max Upload Size: 2 GB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ?
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ? Database
    
    WC Database Version: 8.6.1
    WC Database Prefix: wp_
    Total Database Size: 254.06MB
    Database Data Size: 209.92MB
    Database Index Size: 44.14MB
    wp_woocommerce_sessions: Data: 9.39MB + Index: 0.25MB + Engine MyISAM
    wp_woocommerce_api_keys: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wp_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_woocommerce_order_items: Data: 1.79MB + Index: 0.86MB + Engine MyISAM
    wp_woocommerce_order_itemmeta: Data: 15.68MB + Index: 8.67MB + Engine MyISAM
    wp_woocommerce_tax_rates: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wp_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_woocommerce_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_actionscheduler_actions: Data: 1.06MB + Index: 0.88MB + Engine InnoDB
    wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_logs: Data: 1.08MB + Index: 1.19MB + Engine InnoDB
    wp_admin_columns: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_cm_popfly_history: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_commentmeta: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wp_comments: Data: 3.66MB + Index: 1.30MB + Engine MyISAM
    wp_failed_jobs: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_gglcptch_allowlist: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_groups_capability: Data: 0.00MB + Index: 0.02MB + Engine MyISAM
    wp_groups_group: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_groups_group_capability: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_groups_user_capability: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_groups_user_group: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_huge_itslider_images: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_huge_itslider_params: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_huge_itslider_sliders: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_links: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_mailchimp_carts: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_mailchimp_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_omnisend_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_options: Data: 10.93MB + Index: 1.22MB + Engine MyISAM
    wp_pimwick_gift_card: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_pimwick_gift_card_activity: Data: 0.01MB + Index: 0.00MB + Engine MyISAM
    wp_postmeta: Data: 86.04MB + Index: 19.24MB + Engine MyISAM
    wp_posts: Data: 55.90MB + Index: 2.65MB + Engine MyISAM
    wp_pptrack_codes: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_queue: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_redirection_404: Data: 0.09MB + Index: 0.05MB + Engine MyISAM
    wp_redirection_groups: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_redirection_items: Data: 0.02MB + Index: 0.04MB + Engine MyISAM
    wp_redirection_logs: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wp_social_links: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine MyISAM
    wp_terms: Data: 0.01MB + Index: 0.02MB + Engine MyISAM
    wp_term_relationships: Data: 0.49MB + Index: 1.01MB + Engine MyISAM
    wp_term_taxonomy: Data: 0.01MB + Index: 0.01MB + Engine MyISAM
    wp_usermeta: Data: 3.75MB + Index: 1.71MB + Engine MyISAM
    wp_users: Data: 0.16MB + Index: 0.16MB + Engine MyISAM
    wp_wcpdf_invoice_number: Data: 0.06MB + Index: 0.03MB + Engine MyISAM
    wp_wcpdf_packing_slip_number: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_customer_lookup: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
    wp_wc_download_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_product_lookup: Data: 1.52MB + Index: 0.97MB + Engine InnoDB
    wp_wc_order_stats: Data: 0.22MB + Index: 0.17MB + Engine InnoDB
    wp_wc_order_tax_lookup: Data: 0.13MB + Index: 0.11MB + Engine InnoDB
    wp_wc_product_attributes_lookup: Data: 0.06MB + Index: 0.05MB + Engine InnoDB
    wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_product_meta_lookup: Data: 1.52MB + Index: 1.19MB + Engine InnoDB
    wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_webhooks: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_wfBlockedIPLog: Data: 0.07MB + Index: 0.05MB + Engine MyISAM
    wp_wfBlocks7: Data: 0.11MB + Index: 0.09MB + Engine MyISAM
    wp_wfConfig: Data: 3.01MB + Index: 0.02MB + Engine MyISAM
    wp_wfCrawlers: Data: 0.01MB + Index: 0.01MB + Engine MyISAM
    wp_wfFileChanges: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_wfFileMods: Data: 5.14MB + Index: 0.62MB + Engine MyISAM
    wp_wfHits: Data: 2.81MB + Index: 0.77MB + Engine MyISAM
    wp_wfHoover: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_wfIssues: Data: 0.02MB + Index: 0.01MB + Engine MyISAM
    wp_wfKnownFileList: Data: 3.71MB + Index: 0.19MB + Engine MyISAM
    wp_wfLiveTrafficHuman: Data: 0.03MB + Index: 0.04MB + Engine MyISAM
    wp_wfLocs: Data: 0.02MB + Index: 0.01MB + Engine MyISAM
    wp_wfLogins: Data: 0.45MB + Index: 0.08MB + Engine MyISAM
    wp_wfls_2fa_secrets: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wfls_role_counts: Data: 0.00MB + Index: 0.00MB + Engine MEMORY
    wp_wfls_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wfNotifications: Data: 0.01MB + Index: 0.00MB + Engine MyISAM
    wp_wfPendingIssues: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_wfReverseCache: Data: 0.22MB + Index: 0.04MB + Engine MyISAM
    wp_wfSecurityEvents: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wfSNIPCache: Data: 0.01MB + Index: 0.02MB + Engine MyISAM
    wp_wfStatus: Data: 0.21MB + Index: 0.08MB + Engine MyISAM
    wp_wfTrafficRates: Data: 0.01MB + Index: 0.01MB + Engine MyISAM
    wp_wfWafFailures: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_square_customers: Data: 0.02MB + Index: 0.02MB + Engine MyISAM
    wp_wotv_woo_track_info: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_ycd_subscribers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_yith_wcwl: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_yith_wcwl_lists: Data: 0.00MB + Index: 0.01MB + Engine MyISAM Post Type Counts
    
    attachment: 5625
    cm-ad-item: 22
    custom_css: 1
    nav_menu_item: 138
    oembed_cache: 18
    options: 1
    page: 77
    post: 2
    product: 1323
    product_variation: 599
    revision: 3495
    shop_coupon: 172
    shop_order: 3908
    shop_order_refund: 18
    symbol_main_slider: 1
    wcbox: 1
    wcps: 1
    woocarousel: 1
    wp_global_styles: 1
    ycdcountdown: 3 Security
    
    Secure connection (HTTPS): ?
    Hide errors from visitors: ? Active Plugins (29)
    
    FiboSearch - AJAX Search for WooCommerce: by FiboSearch Team – 1.27.0
    Role and Customer Based Pricing for WooCommerce: by Meow Crew – 1.5.2
    weLaunch Framework: by weLaunch.io – 1.1.1
    Canada Post Shipping For WooCommerce: by Small Fish Analytics Inc. – 2.9.14
    CM Pop-Up banners for WordPress: by CreativeMindsSolutions – 1.6.2
    Admin Columns: by AdminColumns.com – 4.6.1
    reCaptcha by BestWebSoft: by BestWebSoft – 1.74
    Nav Menu Roles: by Kathy Darling – 2.1.2
    PW WooCommerce Gift Cards: by Pimwick
    LLC – 1.252
    
    Sezzle WooCommerce Payment: by Sezzle – 5.0.8
    Page Builder by SiteOrigin: by SiteOrigin – 2.29.5
    SiteOrigin Widgets Bundle: by SiteOrigin – 1.58.9
    Tawk.to Live Chat: by Tawkto – 0.8.2
    Advanced Editor Tools: by Automattic – 5.9.2
    TrustedSite: by TrustedSite – 1.2.0
    WPC Fly Cart for WooCommerce: by WPClever – 5.6.5
    Orders Tracking for WooCommerce: by VillaTheme – 1.2.7
    Variation Swatches for WooCommerce: by Emran Ahmed – 2.0.30
    WooCommerce Extended Coupon Features FREE: by Soft79 – 3.3.3
    FOX - Currency Switcher Professional for WooCommerce: by realmag777 – 1.4.1.7
    PDF Invoices & Packing Slips for WooCommerce: by WP Overnight – 3.7.7
    Woocommerce Products Per Page: by Jeroen Sormani – 1.2.7
    WooCommerce Reward Points: by weLaunch – 1.1.20
    Role Based Price For WooCommerce: by Varun Sridharan – 3.3.7
    WooCommerce Square: by WooCommerce – 4.5.0 (update to version 4.5.1 is available)
    WooCommerce: by Automattic – 8.6.1
    Wordfence Security: by Wordfence – 7.11.3
    WP-PageNavi: by Lester 'GaMerZ' Chan – 2.94.1
    Google XML Sitemaps Generator: by WPGrim – 1.8.4 Inactive Plugins (4)
    
    Classic Editor: by WordPress Contributors – 1.6.3
    Redirection: by John Godley – 5.4.2
    Restrict Widgets: by dFactory – 1.3.1
    Under Construction: by WebFactory Ltd – 3.99 Must Use Plugins (2)
    
    Endurance Page Cache: by Mike Hansen – 2.2
    SSO: by Garth Mortensen
    Mike Hansen – 0.4 Settings
    
    API Enabled: –
    Force SSL: ?
    Currency: CAD (CAD$)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    pw gift card (pw-gift-card)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to Woo.com: –
    Enforce Approved Product Download Directories: –
    HPOS feature screen enabled: –
    HPOS feature enabled: –
    Order datastore: WC_Order_Data_Store_CPT
    HPOS data sync enabled: – WC Pages
    
    Shop base: #490 - /shop/
    Cart: #491 - /cart/
    Checkout: #492 - /checkout/
    My account: #493 - /my-account/
    Terms and conditions: #653 - /terms/ Theme
    
    Name: Top Shop Child
    Version: 1.0.0
    Author URL: https://wordpress.com
    Child Theme: ?
    Parent Theme Name: TopShop
    Parent Theme Version: 1.3.14 – 1.3.40 is available
    Parent Theme Author URL: https://kairaweb.com/
    WooCommerce Support: ? Templates
    
    Overrides: topshop-child/myaccount/dashboard.php Square
    
    Environment: Production
    Tokenization Enabled: –
    Debug Mode: Off Admin
    
    Enabled Features: activity-panels
    analytics
    product-block-editor
    coupons
    core-profiler
    customer-effort-score-tracks
    import-products-task
    experimental-fashion-sample-products
    shipping-smart-defaults
    shipping-setting-tour
    homescreen
    marketing
    mobile-app-banner
    navigation
    onboarding
    onboarding-tasks
    product-variation-management
    product-virtual-downloadable
    product-external-affiliate
    product-grouped
    product-linked
    remote-inbox-notifications
    remote-free-extensions
    payment-gateway-suggestions
    shipping-label-banner
    subscriptions
    store-alerts
    transient-notices
    woo-mobile-welcome
    wc-pay-promotion
    wc-pay-welcome-page
    
    Disabled Features: customize-store
    minified-js
    new-product-management-experience
    product-pre-publish-modal
    settings
    async-product-editor-category-field
    
    Daily Cron: ? Next scheduled: 2024-03-05 19:23:36 -07:00
    Options: ?
    Notes: 23
    Onboarding: completed Action Scheduler
    
    Complete: 1,331
    Oldest: 2024-02-03 20:47:27 +0000
    Newest: 2024-03-05 14:53:23 +0000
    
    Failed: 147
    Oldest: 2020-06-26 20:38:19 +0000
    Newest: 2024-01-29 23:54:11 +0000
    
    Pending: 2
    Oldest: 2024-03-05 21:13:09 +0000
    Newest: 2024-03-10 20:06:01 +0000 Status report information
    
    Generated at: 2024-03-05 12:21:03 -07:00
    

    Hi @kissmylegs!

    Thank you for providing more information.

    Checking your system status report, I can’t notice anything causing the undefined array key; it could be related to the recent updates.

    You mentioned you have a test site with plugins and theme up to date; let’s try performing a conflict test there and see if that helps to solve the issue.

    Please temporarily switch your theme back to Storefront, disable all plugins except WooCommerce, and then check again if the issue persists.

    If that solves it, reactivate the theme first and check again. Then, reactivate your other plugins, testing after each, until you find the one causing conflict.

    You can find a more detailed explanation of how to do a conflict test here: https://woo.com/document/how-to-test-for-conflicts/

    Let us know how that goes for you!

    Thread Starter KissMyLegs

    (@kissmylegs)

    I’ll need a week or so to do this as my schedule is very busy. I’ll report back once I have done my testing, so please leave this ticket open for a while.
    Thanks – Dave

    Thread Starter KissMyLegs

    (@kissmylegs)

    Nevermind. LOL. I believe I have isolated the issue. It was some custom code that renamed the tabs inside a single product page. There is one instance where the product I show does not have the “Additional Information” tab, so the code throws an error (Undefined “title”)!!

    Adding this to my custom code seems to have fixed the issue:

    if(!isset($tabs[‘additional_information’])) {return $tabs;}

    If there is a better way to fix this issue, please let me know.
    Sorry for bothering you. This took me only a few hours to diagnose and fix.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @kissmylegs,

    I’m glad to hear that you were able to identify and rectify the issue with the custom code on your single product page. The solution you implemented seems to be a good one. It checks if the additional_information tab is set before attempting to use it, which prevents the undefined title error.

    However, if you want to improve your code further, you might consider adding an else statement to handle cases where the additional_information tab is not set. This could provide a default value or an error message to help with debugging in the future.

    I hope this helps!

    Meanwhile, I will mark this thread as resolved. Should you have further inquiries, kindly create a new topic here.

    Thanks!

    Thread Starter KissMyLegs

    (@kissmylegs)

    It looks like I’m still seeing warnings for WooCommerce. I hope it’s okay to post here and not start a new thread, as what I’m reporting today is related to what we already discussed.

    Has something changed in core where it's now "suggested" to declare all variables before use? 
    
    Like in:
    
    $myValue;
    $myValue = getValue();
    if( $myValue == 'Something' )
    {...}
    
    Now, I know you'll say getValue() should return something no matter what, and I agree with you. It's just an example where $myValue might not have been set prior to it being tested for a value of 'Something'.
    
    Also:
    
    $myArray = getArray();
    $aValue = $myArray[0];
    If( $aValue == 'Something' )
    {...}
    If there is no array at $myArray[0] this is now producing a warning)
    So, I would update the code to something like:
    if( isset( $myArray[0] ))
    {
          $aValue = $myArray[0];
    }
    else
    {
          $aValue = 'something';
    }
    
    
    
    Code that has worked flawlessly for years is now (sometimes) producing warnings.
    
    --------------------------------------------------------
    Here are the latest (WooCommerce) warnings:
    
    

    [07-Mar-2024 02:10:09 UTC] PHP Warning: Trying to access array offset on value of type bool in /…/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 2691

    [07-Mar-2024 08:03:46 UTC] PHP Warning: Trying to access array offset on value of type bool in /…/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1611

    [07-Mar-2024 08:03:46 UTC] PHP Warning: Trying to access array offset on value of type bool in /…/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1612

    [07-Mar-2024 08:03:46 UTC] PHP Warning: Trying to access array offset on value of type bool in /…/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1613

    [07-Mar-2024 08:03:46 UTC] PHP Warning: Trying to access array offset on value of type bool in /…/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1614

    [07-Mar-2024 08:03:46 UTC] PHP Warning: Trying to access array offset on value of type bool in /…/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1623

    Thread Starter KissMyLegs

    (@kissmylegs)

    So, after doing some further research, it seems the issues I am having are not directly related to WooCommerce. It seems things broke with the latest WordPress update. I am now also seeing warnings from some of my other plugins (where just the other day I didn’t see any warnings.) A suggested fix is to add this to wp-config.php:

    if ( ! isset( $_SERVER[‘HTTP_HOST’]))
    {
    $_SERVER[‘HTTP_HOST’] = ‘change to URL of your site’
    }

    I have gone and added this to my sandbox environment and I will monitor it for a few days to see if the warnings go away. I may even add this to my live site; I’m sure it can’t hurt anything by doing so.

    Do you have any other suggestions?

    Thanks – Dave

    Hey, @kissmylegs!

    While my colleague shared some insight, please note that we can’t provide support for code customization as per our support policy.

    We suggest visiting the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there too.

    I hope this was clarifying.

    Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

    Thread Starter KissMyLegs

    (@kissmylegs)

    Thanks. It sounds like there are many people experiencing the same issues as me (submitting tickets to you) (since WordPress latest update). Even when I switched to Storefront theme, deactivated all plugins, and remove not referencing custom code in my functions.php file; the warnings were still present in my error log file. Hence the only warnings were for WooCommerce though (because other than the WooCommerce plugin being active, WordPress was the only source to blame this on). This issue seems to NOT be caused by your plugin, any of my other plugins, my custom code (functions.php), etc., but solely WordPress (core files).

    Thread Starter KissMyLegs

    (@kissmylegs)

    Doing some further research, could this issue be related to the PHP version I am using (v8.0.30)? I have read that other people also experience the same issue (across multiple plugins). They (like I) have tried using just Storefront and disabling all plugins (except WooCommerce) and the problem still exists. I have also received similar warnings from some of my plugins, too.

    Thread Starter KissMyLegs

    (@kissmylegs)

    To fix this issue in my sandbox environment, I went to line 2691 in woocommerce/includes/wc-template-functions.php and changed:

    $image = $image[0];


    to:

    if( isset( $image[0] ) )
    {
    $image = $image[0];
    }

    For now, this seems to have fixed the issue. I’m still at a loss to decipher whether this is an issue with your code, an issue with WordPress or an issue with PHP v8.0.30

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @kissmylegs,

    Thank you for the additional details. I’m happy you’ve fixed this issue for you. From your System Status Report, I see you have WooCommerce and WordPress in your latest versions. Have you tried other PHP versions to rule this out?

    Additionally, you mentioned you found the error on your logs:

    [05-Mar-2024 16:11:05 UTC] PHP Warning: Trying to access array offset on value of type bool in /…/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 2691

    I’d like to learn more. Is this something that’s affecting your site in the front end or back end in any way? Do you get any visible errors or something broken / not functioning as expected? Which steps could we take to replicate this issue?

    Thanks!
    -OP

    Thread Starter KissMyLegs

    (@kissmylegs)

    Hi.. these warnings are not affecting my live site as I have the warnings set to not show. As for the steps taken to reproduce: I can’t provide that. The warning(s) appear randomly when users are on my site. Code (plugins and functions.php) that has worked for 7 years is suddenly producing warnings all over the place. It really does look like these warnings are a result of the latest PHP release. Though some plugins are not producing warnings of any kind. WooCommerce and maybe 2 other plugins I use are producing warnings. As noted earlier, I was still getting the warnings even when I switched my theme to Storefront and deactivated ALL plugins except WooCommerce. The warnings were specific to your plugin only, of course. I’ve read enough posts on the ‘net to know this is a widespread issue. Perhaps the latest (or last few) release of PHP has made it mandatory that a variable must be initialized (instantiated?) before use? My error log file had grown to over 2MB. I am also seeing one CRON job that failed, where it never has in the past.

    [10-Mar-2024 08:16:05 UTC] Cron reschedule event error for hook: action_scheduler_run_queue, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {“schedule”:”every_minute”,”args”:[“WP Cron”],”interval”:60}

    To have a site work for many years without issue and to now see these warnings being logged, it’s a bit frustrating. Obviously WooCommerce is not the cause of the warnings, but some of the warnings are a result of some code not properly written(?) Not bashing anyone here!

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Undefined Array Key’ is closed to new replies.