[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');
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?
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.
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.
Re: PHP Fatal error: Undefined constant 'PHP_DATE_TIME_FORMAT'
Clarification: The constant will be removed in v1.6.0