Page 1 of 3 123 LastLast
Results 1 to 10 of 24
  1. #1
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    806
    Plugin Contributions
    0

    Default Site Crashed U_ILLEGAL_ARGUMENT_ERROR in IntlDateFormatter

    EDIT: Affects 8.1.25, 8.2.12, and 8.3.0RC3+

    Hello All,
    1.5.8 (forget the revision) on php 8.2. Woke this morning to white screens in admin and front end.

    Code:
    [02-Nov-2023 10:05:18 America/New_York] Request URI: /manufactuername-m-1.html, IP address: 11.22.33.44
    --> PHP Fatal error: Uncaught IntlException: datefmt_create: invalid locale: U_ILLEGAL_ARGUMENT_ERROR in /home/account/www.website.com/includes/classes/zcDate.php:87
    Stack trace:
    #0 /home/account/www.website.com/includes/classes/zcDate.php(87): IntlDateFormatter->__construct('C', 3, -1)
    #1 /home/account/www.website.com/includes/classes/zcDate.php(39): zcDate->initializeConversionArrays()
    #2 /home/account/www.website.com/includes/autoload_func.php(47): zcDate->__construct()
    #3 /home/account/www.website.com/includes/application_top.php(237): require('/home/account...')
    #4 /home/account/www.website.com/index.php(25): require('/home/account...')
    #5 {main}
      thrown in /home/account/www.website.com/includes/classes/zcDate.php on line 87.
    Please help.

    Thank you,
    John

  2. #2
    Join Date
    Jun 2005
    Posts
    309
    Plugin Contributions
    0

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    Me too, thought it was the hosting service
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

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

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    I just switched php back to 8.0 and it's running again seemingly without errors or warnings. I'd really like to get this resolved though so we can go back to 8.2.

    Thanks again,
    John

  4. #4
    Join Date
    Apr 2009
    Posts
    418
    Plugin Contributions
    2

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    This has just started happening on my test site. Live is ok.
    It appears that this code in includes/classes/zcDate.php is the issue
    Code:
                $this->locale = setlocale(LC_TIME, 0);
    
                // -----
                // Using the current locale, retrieve the locale-specific 'short' date and time
                // formats.
                //
                $format = new IntlDateFormatter(
                    $this->locale,
                    IntlDateFormatter::SHORT,
                    IntlDateFormatter::NONE
                );
    The issue appears to be that if setlocale has not been called before zcDate is initialised the server returns a local of "C" this appears to mean not set yet.
    I found this from @DrByte https://github.com/php/php-src/issues/12561#issuecomment-1786428271

    I don't know enough to fix this.

    I suspect that zcDate class is being initialised before setlocale is set in

    includes/languages/lang.english.php
    YOURADMIN/languages/lang.english.php

    If I add the setlocale from the language file to the begining index.php and YOURADMIN/index.php the system seems to work OK. This is a workaround and not a solution! I will try a few other things to find a solution. Mean while if @drByte, @lat9... could look at this.
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

  5. #5
    Join Date
    Jun 2005
    Posts
    309
    Plugin Contributions
    0

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    I agree. index.php requires includes/application_top.php, which loads the autoloaders including config.core.php, which calls zcDate.php
    only after application_top.php does all its stuff are the language files parsed, including the setlocale
    set locale may need to be moved to configure.php instead...
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

  6. #6
    Join Date
    Jun 2005
    Posts
    309
    Plugin Contributions
    0

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    lol, now that I'm all caught up on github convo I see that drbyte has just about decided the same.
    https://github.com/zencart/zencart/issues/6037
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

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

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    Yes, the latest updates to PHP (PHP 8.1.25 and 8.2.12) added a sudden fatal error when the locale is not explicitly configured on the server.
    They claim to be backing it down in subsequent PHP 8.1 (8.1.26) and 8.2 (8.2.13) releases, but appear to be keeping it in 8.3-onward, so a workaround is needed:
    ie: configure a default locale in PHP.

    IMO the simplest fix for existing stores, is simply to add a default locale to your configure.php files:

    /includes/configure.php
    and
    /admin/includes/configure.php
    Code:
    @setlocale(LC_TIME, ['en_US', 'en_US.UTF-8', 'en-US']);

    (Obviously, you could put your own preferred language locale in there, but is overridden later anyway. See note below.)

    It can be put on its own line anywhere after the opening "<php" line or at the bottom of the file.

    Zen Cart's default application_top bootstrapping process will auto-detect whatever language the store and/or customer really wants, and will reset it to that before any normal output is generated. So don't need to do any additional changes to your language files etc.
    Last edited by DrByte; 2 Nov 2023 at 11:00 PM. Reason: updated 'en' to 'en_US' with UTF8 fallback and 'en-US' for Windows servers
    .

    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.

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

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    This doesn't seem to work on my test installation. PHP 8.1. Fails on both storefront and admin.
    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.

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

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    I appreciate the input from the Zen Cart team.

    But the proposed fix is also not working on my test cart. ZC 1.5.8, PHP 8.2

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

    Default Re: Site Crashed U_ILLEGAL_ARGUMENT_ERROR

    Hmmm. Investigating ...
    .

    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 3 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