Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24
  1. #11
    Join Date
    Jun 2005
    Posts
    309
    Plugin Contributions
    0

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    proposed
    HTML Code:
    @setlocale(LC_TIME, 'en');
    doesn't work, but the complete:
    Code:
    $locales = ['en_US', 'en_US.utf8', 'en', 'English_United States.1252'];
    @setlocale(LC_TIME, $locales);
    DOES work. No clue why.
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

  2. #12
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    My bad. Turns out 'en' alone isn't "valid" either. And that's what I had in my clipboard when I pasted. Doh!

    EDITED: now recommending:
    Code:
    @setlocale(LC_TIME, ['en_US', 'en_US.UTF-8', 'en-US']);
    Add this to the end of includes/configure.php and YOUR_ADMIN/includes/configure.php
    Last edited by swguy; 7 Dec 2023 at 07:48 AM. Reason: clarify where to place this code
    .

    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.

  3. #13
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,557
    Plugin Contributions
    28

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    Quote Originally Posted by DrByte View Post
    My bad. Turns out 'en' isn't "valid" either. And that's what I had in my clipboard when I pasted. Doh!

    Use:
    Code:
    @setlocale(LC_TIME, 'en_US');
    I can confirm this works in my testing. en is so close to en_US.

  4. #14
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,703
    Plugin Contributions
    123

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    Confirmed on admin and storefront in PHP 8.1. Thanks, @drbyte!
    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.
    Do you benefit from Zen Cart? Then please support the project.

  5. #15
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    I updated my "fix" with adding UTF-8 fallback, just in case.
    (FYI The hyphenated uppercase en_US.UTF-8 works on my dev site, where the en_US.utf8 lowercase without hyphen shows as invalid when used on its own. Might be different on different servers with different locale packs installed at the server level.)

    And for local PC servers running Windows, it seems 'en-US' may be what's needed.
    .

    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.

  6. #16
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    806
    Plugin Contributions
    0

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    Confirmed working on php 8.2. Thank you all very much!

    Best,
    John

  7. #17
    Join Date
    Jan 2014
    Posts
    216
    Plugin Contributions
    0

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    So I was getting the HTTP 500 error when going to my store as a user or an admin. I switched the PHP to 8 and still same issue, I switched back to 8.1 and it works.

    I was getting the following error
    [08-Nov-2023 20:52:03 America/New_York] PHP Fatal error: Uncaught IntlException: datefmt_create: invalid locale: U_ILLEGAL_ARGUMENT_ERROR in /homepages/website/store/includes/classes/zcDate.php:90
    Stack trace:
    #0 /homepages/website/store/includes/classes/zcDate.php(90): IntlDateFormatter->__construct()
    #1 /homepages/website/store/includes/classes/zcDate.php(39): zcDate->initializeConversionArrays()
    #2 /homepages/website/store/includes/autoload_func.php(47): zcDate->__construct()
    #3 /homepages/website/store/Skill-ieE-trusT/includes/application_top.php(42): require('/homepages/36/d...')
    #4 /homepages/website/store/Skill-ieE-trusT/home.php(9): require('/homepages/36/d...')
    #5 /homepages/website/store/Skill-ieE-trusT/index.php(11): require('/homepages/36/d...')
    #6 {main}
    thrown in /homepages/website/store/includes/classes/zcDate.php on line 90

    [08-Nov-2023 20:52:03 America/New_York] Request URI: /store/Skill-ieE-trusT/, IP address: 136.226.82.111
    --> PHP Fatal error: Uncaught IntlException: datefmt_create: invalid locale: U_ILLEGAL_ARGUMENT_ERROR in /homepages/website/store/includes/classes/zcDate.php:90
    Stack trace:
    #0 /homepages/website/store/includes/classes/zcDate.php(90): IntlDateFormatter->__construct()
    #1 /homepages/website/store/includes/classes/zcDate.php(39): zcDate->initializeConversionArrays()
    #2 /homepages/website/store/includes/autoload_func.php(47): zcDate->__construct()
    #3 /homepages/website/store/Skill-ieE-trusT/includes/application_top.php(42): require('/homepages/36/d...')
    #4 /homepages/website/store/Skill-ieE-trusT/home.php(9): require('/homepages/36/d...')
    #5 /homepages/website/store/Skill-ieE-trusT/index.php(11): require('/homepages/36/d...')
    #6 {main}
    thrown in /homepages/website/store/includes/classes/zcDate.php on line 90.

  8. #18
    Join Date
    Jan 2014
    Posts
    216
    Plugin Contributions
    0

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    spoke too soon. I did add the code to the config files and it fixed it.
    Code:
    @setlocale(LC_TIME, ['en_US', 'en_US.UTF-8', 'en-US']);

  9. #19
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    123
    Plugin Contributions
    5

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    Few month ago I submitted on github a re-write of class file zc_date.php based on intl date_format object instead of srftime(). It was not accepted at the time but it might change now. Basically instead of using depracated strftime parameters it uses datefm_create if installed and if not date(). I made it compatible with strftime parameters so old plugins still work.
    I use this mod on my live site and some test sites and was not affected when updating to PHP 8.1.25 or 8.2.12!
    If you want to try it you can just copy class file zc_date.php (after backing up your original version). If you want to be more efficient and eliminate old strftime parameters copy/merge all other files.
    By the way I hope that in new Zencart 2.0 strftime % parameter won't be use any more.
    here is the link to github repo: https://github.com/piloujp/zcDate_mod
    Last edited by pilou2; 9 Nov 2023 at 02:47 PM.

  10. #20
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,497
    Plugin Contributions
    88

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    Noting that the zcDate.php class is PHP version-specific, using strftime for PHP versions < 8.1 and using the IntlDateFormatter class (if that PHP extension is installed) otherwise.

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. v158 IntlDateFormatter php issue
    By gothstone in forum Bug Reports
    Replies: 2
    Last Post: 22 Feb 2024, 11:55 AM
  2. v158 U_illegal_argument_error
    By jeking in forum General Questions
    Replies: 2
    Last Post: 2 Nov 2023, 08:13 PM
  3. v156 Site and Admin crashed!!!
    By wmorris in forum General Questions
    Replies: 9
    Last Post: 10 Jun 2019, 05:20 PM
  4. Replies: 11
    Last Post: 19 Sep 2009, 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