Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Oct 2009
    Posts
    425
    Plugin Contributions
    0

    Default A couple of PHP Warnings

    I wanted to post these couple of PHP Warnings I've come across to hopefully help with future updates...and as well, if you could let me know what code to add now, so I can correct these and not have to go through these same ones each day.

    #1 - I sell digital products, and when updating a customer's order to give them more download attempts, I get the following in my Debug Log...
    PHP Warning: Undefined array key 1 in /includes/classes/shopping_cart.php on line 2669.

    When I update more than 1 order...it then also gives me....Undefined array key 2 (in the same file on the same line)
    Undefined array key 3...etc.

    #2 - I am doing a cross promotion with another company and am giving a free coupon code to their customers. When the customer uses this code, I get the following PHP Warning in my Debug Log....
    PHP Warning: Undefined global variable $free in includes/modules/payment/paypaldp.php on line 1645.
    and also...
    PHP Warning: Attempt to read property "tax_class" on null in includes/modules/payment/paypaldp.php on line 1645

    Thanks for your help!

  2. #2
    Join Date
    Oct 2009
    Posts
    425
    Plugin Contributions
    0

    Default Re: A couple of PHP Warnings

    One other Debug Log PHP warning I received this morning while inserting a new product is...

    PHP Warning: Undefined variable $attributes_value in Admin/attributes_controller.php on line 1962

    Would someone be able to supply to code to correct this warning??

    Thanks!

  3. #3
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,295
    Plugin Contributions
    1

    Default Re: A couple of PHP Warnings

    Quote Originally Posted by NWCE View Post
    One other Debug Log PHP warning I received this morning while inserting a new product is...

    PHP Warning: Undefined variable $attributes_value in Admin/attributes_controller.php on line 1962

    Would someone be able to supply to code to correct this warning??

    Thanks!
    Has this been addressed previously? Try searching the forum for "Undefined variable $attributes_value", as suggested in the posting tips.
    Simon

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,362
    Plugin Contributions
    94

    Default Re: A couple of PHP Warnings

    Note, too, that when posting a log that it's important to post the full log, including the header (which identifies which page on which the issue occurred) and the backtrace (which identifies the call-chain and, in some instances, possibly the source of the issue).

  5. #5
    Join Date
    Oct 2009
    Posts
    425
    Plugin Contributions
    0

    Default Re: A couple of PHP Warnings

    Thanks simon1066 for passing along the fix for this from another post. I will apply this code change from the Github link!

  6. #6
    Join Date
    Oct 2009
    Posts
    425
    Plugin Contributions
    0

    Default Re: A couple of PHP Warnings

    Thanks lat9 for letting me know that in order to decipher the Debug Log that you need the entire log.

    I will do this with my PHP Warnings...and also see that there is a Bug Report area....will post in there.

    Thanks again

  7. #7
    Join Date
    Oct 2009
    Posts
    425
    Plugin Contributions
    0

    Default Re: A couple of PHP Warnings

    Here is the full Debug Log for one the PHP Warnings (#2) I posted in previous post. Hope this helps to decipher it....and if you would share a code fix that would be great!

    Request URI: /shop/index.php?main_page=checkout_process, IP address: 66.61.47.189, Language id 1
    #0 /home/shop/includes/modules/payment/paypaldp.php(1645): zen_debug_error_handler()
    #1/home/public_html/shop/includes/modules/payment/paypaldp.php(744): paypaldp->getLineItemDetails()
    #2 /home/public_html/shop/includes/classes/payment.php(350): paypaldp->before_process()
    #3 /home/public_html/shop/includes/modules/checkout_process.php(98): payment->before_process()
    #4 /home/public_html/shop/includes/modules/pages/checkout_process/header_php.php(13): require('...')
    #5 /home/public_html/shop/index.php(35): require('...')
    --> PHP Warning: Undefined global variable $free in /home/public_html/shop/includes/modules/payment/paypaldp.php on line 1645.

    [26-Mar-2025 08:45:43 America] Request URI: /shop/index.php?main_page=checkout_process, IP address: 66.61.47.189, Language id 1
    #0 /home/public_html/shop/includes/modules/payment/paypaldp.php(1645): zen_debug_error_handler()
    #1 /home/public_html/shop/includes/modules/payment/paypaldp.php(744): paypaldp->getLineItemDetails()
    #2 /home/public_html/shop/includes/classes/payment.php(350): paypaldp->before_process()
    #3 /home/public_html/shop/includes/modules/checkout_process.php(98): payment->before_process()
    #4 /home/public_html/shop/includes/modules/pages/checkout_process/header_php.php(13): require('...')
    #5 /home/public_html/shop/index.php(35): require('...')
    --> PHP Warning: Attempt to read property "tax_class" on null in /home/public_html/shop/includes/modules/payment/paypaldp.php on line 1645.

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,362
    Plugin Contributions
    94

    Default Re: A couple of PHP Warnings

    Since you didn't say, I'm assuming that you're running zc210.

    Try editing /includes/modules/payment/paypaldp.php, changing line 1645 from
    Code:
            if (isset($GLOBALS[$module]) && $GLOBALS[$module]->tax_class > 0) {
    to
    Code:
            if (($GLOBALS[$module]->tax_class ?? 0) > 0) {
    and let me know if that corrects the issue; if so, I'll get that updated on the Zen Cart GitHub.

  9. #9
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,295
    Plugin Contributions
    1

    Default Re: A couple of PHP Warnings

    Quote Originally Posted by lat9 View Post
    Since you didn't say, I'm assuming that you're running zc210.
    This thread is tagged with v210
    Simon

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,362
    Plugin Contributions
    94

    Default Re: A couple of PHP Warnings

    Quote Originally Posted by simon1066 View Post
    This thread is tagged with v210
    Duh! Thanks for the correction.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v210 A Couple of PHP Warnings On Checkout
    By NWCE in forum Managing Customers and Orders
    Replies: 5
    Last Post: 21 Mar 2025, 06:23 PM
  2. v157 PHP Warnings and Fatal errors after upgrading to PHP 8
    By bigandrew in forum General Questions
    Replies: 9
    Last Post: 29 Jul 2021, 05:31 PM
  3. v156 PHP 7.3 preg_xxxxx Warnings
    By mc12345678 in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 28 Jun 2019, 01:41 PM
  4. Replies: 38
    Last Post: 1 Nov 2018, 09:28 PM
  5. PHP warnings
    By LEP in forum General Questions
    Replies: 4
    Last Post: 6 Jun 2006, 10:31 AM

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