Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jun 2012
    Location
    California
    Posts
    176
    Plugin Contributions
    0

    Default PHP Notice: Undefined offset: 1

    1.5.7c
    PHP 7.2
    Edit Orders 4.6.0
    Twitch Hidden Model for 1.5.7c

    My log file keeps filling up with the below listed error. Any assistance would be greatly appreciated.

    PHP Notice: Undefined offset: 1 in /includes/functions/functions_email.php on line 140

    Code:
    135 // clean up currencies for text emails
    136      $zen_fix_currencies = preg_split("/[:,]/" , str_replace(' ', '', CURRENCIES_TRANSLATIONS));
    137      $size = sizeof($zen_fix_currencies);
    138      for ($i=0, $n=$size; $i<$n; $i+=2) {
    139        $zen_fix_current = $zen_fix_currencies[$i];
    140        $zen_fix_replace = $zen_fix_currencies[$i+1];
    141        if (strlen($zen_fix_current)>0) {
    142          while (strpos($email_text, $zen_fix_current)) $email_text = str_replace($zen_fix_current, $zen_fix_replace, $email_text);
    143        }
    144      }

  2. #2
    Join Date
    Jul 2012
    Posts
    16,038
    Plugin Contributions
    17

    Default Re: PHP Notice: Undefined offset: 1

    If you go to your admin, then configuration and Email... What is the setting for the item titled: 'Convert Currencies for Text Emails'?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jun 2012
    Location
    California
    Posts
    176
    Plugin Contributions
    0

    Default Re: PHP Notice: Undefined offset: 1

    Quote Originally Posted by mc12345678 View Post
    If you go to your admin, then configuration and Email... What is the setting for the item titled: 'Convert Currencies for Text Emails'?
    It is blank

  4. #4
    Join Date
    Jul 2012
    Posts
    16,038
    Plugin Contributions
    17

    Default Re: PHP Notice: Undefined offset: 1

    Quote Originally Posted by wsworx View Post
    It is blank
    To me that seems unusual and likely is why the log is being generated. A default install includes at least two if not three+ pre-existing items in that list. The absence of data may be causing some other value to be returned which is resulting in entering that loop with only one record not two to evaluate.

    Of course one question is what was done to clear that entry/why is it blank instead of the default. (posting tips answers may reveal some of that otherwise may also have a concern of *who* cleared it.)

    I don't have the answer at the moment of what the expected/default data is. For assistance to all readers it will be good to include and if someone else doesn't I will try to look it up and post here especially if you don't find/report those values.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jun 2012
    Posts
    307
    Plugin Contributions
    0

    Default Re: PHP Notice: Undefined offset: 1

    Funny, I am chasing the exact same error. Same symptom, same blank setting in email preferences. I did not knowingly change the default setting so I have no idea how it was wiped out. I went to a clean unmodified version of zc157c and copied the default setting from the database:
    Code:
    &pound;,:&euro;,€:&reg;,:&trade;,™
    I hope copy and paste works.
    Dave

  6. #6
    Join Date
    Jun 2012
    Posts
    307
    Plugin Contributions
    0

    Default Re: PHP Notice: Undefined offset: 1

    Thanks for the hint mc12345678!

  7. #7
    Join Date
    Jun 2012
    Posts
    307
    Plugin Contributions
    0

    Default Re: PHP Notice: Undefined offset: 1

    Perhaps that block of code (lines 136-144) in functions_email.php should be bypassed if CURRENCIES_TRANSLATIONS is empty. In the next zc version???
    Dave

  8. #8
    Join Date
    Jul 2012
    Posts
    16,038
    Plugin Contributions
    17

    Default Re: PHP Notice: Undefined offset: 1

    Quote Originally Posted by Dave224 View Post
    Perhaps that block of code (lines 136-144) in functions_email.php should be bypassed if CURRENCIES_TRANSLATIONS is empty. In the next zc version???
    Dave
    I was somewhat thinking the same thing, but also thinking why would/should it be empty? The proposed ZC defaults appear to be that way because they are needed. There may be others that could be useful to other users, but it seems that there should always at least be the reg and trademark characters. The euro and pound symbols may for some/many be extraneous; however, they are definitely known to be an issue.

    So an important thing here and to potentially address this is to try to identify some commonalities that may have caused this. Please, for those that have arrived here, until an additional request has been made for information, could you provide an indication of database history and install/upgrade "process"? As identified a default install with a base fileset has values here.

    The minimal information requested could potentially help those of the core team address this or possibly some other not yet known related issue...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Jun 2012
    Posts
    307
    Plugin Contributions
    0

    Default Re: PHP Notice: Undefined offset: 1

    I don't have a detailed history of my database, but in general, the zc157c database began way back in zc151, then zc155, then zc155f, and finally to the zc157 series. The database from the previous version was copied to the new version, and then the database update process in the install script was run. In my case, between two updates, the database got scrambled at least once and had to be repaired/restored from backup. The database was modified as new products/categories and plugins/custom coding were added. I might have changed the default value because the description of the configuration variable (CURRENCIES_TRANSLATIONS) describes currencies like the pound or euro which are not applicable to our store. We only deal with English and Dollars. IMHO, it might be less tempting to delete the default if the description was more generic like "html special character entities to symbol translations for text emails", with examples that included currencies, registration mark, trade mark, and other special characters. But I still feel the code should protect itself from "bad" user inputs, especially those input values which create PHP notices or errors.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,350
    Blog Entries
    7
    Plugin Contributions
    271

    Default Re: PHP Notice: Undefined offset: 1

    Quote Originally Posted by Dave224 View Post
    Perhaps that block of code (lines 136-144) in functions_email.php should be bypassed if CURRENCIES_TRANSLATIONS is empty. In the next zc version???
    Dave
    Done! https://github.com/zencart/zencart/c...344184969e218d
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. 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
  2. v157 PHP Notice: Undefined index
    By yueli7 in forum Upgrading to 1.5.x
    Replies: 1
    Last Post: 24 Jul 2020, 06:56 PM
  3. v155 adding constants - PHP Notice: Use of undefined constant
    By torvista in forum Contribution-Writing Guidelines
    Replies: 0
    Last Post: 4 May 2016, 07:07 AM
  4. Replies: 2
    Last Post: 5 May 2010, 09:58 PM
  5. Undefined Notice: Use of undefined constant
    By TheOracle in forum Bug Reports
    Replies: 0
    Last Post: 6 May 2007, 06:33 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