Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,014
    Plugin Contributions
    61

    Default [Done v1.6.0] PHP Fatal error: Undefined constant 'PHP_DATE_TIME_FORMAT'

    We found that the root issue is that older versions of php would silently ignore undefined constants. Php 5.3 enforces this as undefined constants should not be used. Furthermore, since php 5.3, constants can only be defined using the define() function.

    PHP_DATE_TIME_FORMAT is specific to OS Commerce and any derivatives (including zen cart). So, unfortunately, it is not something that we can set in php.ini.

    To use it with php 5.3, add the following line to the includes/languages/your_template/english.php. Using php 5.2 simply ignores the problem of the undefined constant.


    Code:
    // look in your $PATH_LOCALE/locale directory for available locales..
      @setlocale(LC_TIME, 'en_US');
      define('DATE_FORMAT_SHORT', '%m/%d/%Y');  // this is used for strftime()
      define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
      define('DATE_FORMAT', 'm/d/Y'); // this is used for date()
      define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
      define('PHP_DATE_TIME_FORMAT', 'd/m/Y H:i:s');
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

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

    Default Re: PHP Fatal error: Undefined constant 'PHP_DATE_TIME_FORMAT'

    Oddly enough, when I search the v1.5.0 code for PHP_DATE_TIME_FORMAT the only place I see it is a define() statement in the admin english.php. But never used in core code anyplace.

    Where are you seeing the constant actually used, that it's causing an error?
    .

    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. #3
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,014
    Plugin Contributions
    61

    Default Re: PHP Fatal error: Undefined constant 'PHP_DATE_TIME_FORMAT'

    It's not been an issue for Zen Cart itself, but we have seen the issue using other software such as feed generators and reporting mods that cannot determine the format because it is not defined. Adding it to the catalog english defines completely resolves the issue.
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

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

    Default Re: PHP Fatal error: Undefined constant 'PHP_DATE_TIME_FORMAT'

    Okay, so the "bug" is that these external addons are making assumptions about this unused-by-Zen-Cart constant being defined.

    Our fix in core is likely to simply remove the unused constant. Addons should update their code to define the required constant for themselves if it isn't found.
    .

    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.

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

    Default Re: PHP Fatal error: Undefined constant 'PHP_DATE_TIME_FORMAT'

    Clarification: The constant will be removed in v1.6.0
    .

    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.

 

 

Similar Threads

  1. Replies: 4
    Last Post: 10 Nov 2018, 01:32 PM
  2. 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
  3. Replies: 12
    Last Post: 4 Jan 2010, 07:42 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