Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    453
    Plugin Contributions
    1

    red flag Need help with an error log PHP Notice: Undefined offset: in shopping_cart.php

    Just came across a few error logs generated only in the last 2 days, don't think I did anything different to the live site so not sure why they just started generating or if I should be concerned?!
    I'm running 1.5.7c on PHP 7.4 with OPC installed on responsive classic template.

    Searched everywhere and couldn't find anything other than this github link from torvista but I'm not sure what needs to be done?! https://github.com/zencart/zencart/issues/2894

    Here is the full error log (I merged them together):
    Code:
    [27-Sep-2021 08:05:33 Australia/Sydney] Request URI: /index.php?main_page=shopping_cart&action=update_product, IP address: 106.00.00.00
    #1  shoppingCart->in_cart_product_mixed_changed() called at [/includes/classes/shopping_cart.php:1731]
    #2  shoppingCart->actionUpdateProduct() called at [/includes/main_cart_actions.php:37]
    #3  require(/includes/main_cart_actions.php) called at [/includes/init_includes/init_cart_handler.php:44]
    #4  require_once(/includes/init_includes/init_cart_handler.php) called at [/includes/autoload_func.php:37]
    #5  require(/includes/autoload_func.php) called at [/includes/application_top.php:222]
    #6  require(/includes/application_top.php) called at [/index.php:25]
    --> PHP Notice: Undefined offset: 68 in /includes/classes/shopping_cart.php on line 2556.
    --> PHP Notice: Undefined offset: 66 in /includes/classes/shopping_cart.php on line 2555.
    --> PHP Notice: Undefined offset: 38 in /includes/classes/shopping_cart.php on line 1737.
    --> PHP Notice: Undefined offset: 14 in /includes/classes/shopping_cart.php on line 2555.
    --> PHP Notice: Undefined offset: 14 in /includes/classes/shopping_cart.php on line 2556.
    Below is the corresponding lines:
    Code:
        $changed_array = array(
             'state'=>false,
             'changed' => $product_changed,
    Line 2555:          'total_change' => $product_total_change[$pr_id],
    Line 2556:          'last_changed' => $product_last_changed[$pr_id],
             'increase' => $product_increase,
             'decrease' => $product_decrease,
           );
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,990
    Plugin Contributions
    109

    Default Re: Need help with an error log PHP Notice: Undefined offset: in shopping_cart.php

    Turn off notices. This is not worth your while.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.

  3. #3
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    453
    Plugin Contributions
    1

    Default Re: Need help with an error log PHP Notice: Undefined offset: in shopping_cart.php

    Quote Originally Posted by swguy View Post
    Turn off notices. This is not worth your while.
    Ok Scott, if you say so.
    Can you please direct me on how to turn off notices for this particular notice?
    Also, any idea why this started generating all of a sudden but wasn't for the last few months on this new website?
    I'm wondering it it was something I did that is causing this but can't think of what I have done?!
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,990
    Plugin Contributions
    109

    Default Re: Need help with an error log PHP Notice: Undefined offset: in shopping_cart.php

    Normally notices *are* off. If you turned them on, you might have installed the Report All Errors plugin, which you can dial back to not show notices (only warnings, errors, etc.)

    https://www.zen-cart.com/downloads.php?do=file&id=1792

    Or perhaps you modified includes/extra_configures/enable_error_logging.php ?
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,990
    Plugin Contributions
    109

    Default Re: Need help with an error log PHP Notice: Undefined offset: in shopping_cart.php

    Oddly enough, someone else reported this in Github Issues today. https://github.com/zencart/zencart/issues/4466
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.

  6. #6
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    453
    Plugin Contributions
    1

    Default Re: Need help with an error log PHP Notice: Undefined offset: in shopping_cart.php

    That is odd indeed, not sure what's with that.
    Ok, I added the below code in /includes/classes/shopping_cart.php on line 2552 and commented out line 2555/2556, is this correct?

    Code:
    if (isset($product_total_change[$pr_id])) {
         $ changed_array['total_change'] = $product_total_change[$pr_id]; 
    }
    if (isset($product_last_changed[$pr_id])) {
         $ changed_array['last_changed'] = $product_last_changed[$pr_id]; 
    }
             $changed_array = array(
             'state'=>false,
             'changed' => $product_changed,
    //         'total_change' => $product_total_change[$pr_id],
    //         'last_changed' => $product_last_changed[$pr_id],
             'increase' => $product_increase,
             'decrease' => $product_decrease,
           );
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

  7. #7
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,990
    Plugin Contributions
    109

    Default Re: Need help with an error log PHP Notice: Undefined offset: in shopping_cart.php

    No this is wrong. The two isset blocks need to be *below* the array definition.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.

  8. #8
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    453
    Plugin Contributions
    1

    Default Re: Need help with an error log PHP Notice: Undefined offset: in shopping_cart.php

    Quote Originally Posted by swguy View Post
    No this is wrong. The two isset blocks need to be *below* the array definition.
    Thanks again Scott, I moved it to under the code.
    Code:
        $changed_array = array(
             'state'=>false,
             'changed' => $product_changed,
    //         'total_change' => $product_total_change[$pr_id],
    //         'last_changed' => $product_last_changed[$pr_id],
             'increase' => $product_increase,
             'decrease' => $product_decrease,
           );
           
        if (isset($product_total_change[$pr_id])) {
         $ changed_array['total_change'] = $product_total_change[$pr_id]; 
          }
        if (isset($product_last_changed[$pr_id])) {
         $ changed_array['last_changed'] = $product_last_changed[$pr_id]; 
          }
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

 

 

Similar Threads

  1. Replies: 9
    Last Post: 9 Aug 2021, 06:00 AM
  2. v157 PHP Notice: Undefined offset: 1
    By wsworx in forum General Questions
    Replies: 11
    Last Post: 26 Jun 2021, 03:17 PM
  3. v157 v157b PHP Notice: Undefined index: SSL_SESSION_ID
    By marton_1 in forum Upgrading to 1.5.x
    Replies: 2
    Last Post: 17 Apr 2021, 03:45 PM
  4. v157 PHP Notice: Undefined index
    By yueli7 in forum Upgrading to 1.5.x
    Replies: 1
    Last Post: 24 Jul 2020, 06:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR