Jump to content



Issue Information

  • #000533

  • 0 - None Assigned

  • New

  • 2.3.3

  • -

Issue Confirmations

  • Yes (0)No (0)
Photo

default_timezone_get(): It is not safe php 5.4

Posted by Gyakutsuki on 16 October 2012 - 13:21

There the error for the latest php on ubuntu 12.10

date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/............/includes/functions/compatibility.php on line 42

Catalog + administration

5.4.6-1ubuntu1 (Zend : 2.4.0)

Sorry, it's ok, it's my false.

I re-test, I confirm, there is a problem with php 5.4

Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.


  if (PHP_VERSION >= '5.2') {
    date_default_timezone_set(defined('CFG_TIME_ZONE') ? CFG_TIME_ZONE : date_default_timezone_get());
  }

It's not the better solution but it work :


  if ((strlen(ini_get('date.timezone')) < 1) && function_exists('date_default_timezone_set')) {
    date_default_timezone_set(@date_default_timezone_get());
  }


@Gyakutsuki

My conclusions are differents. Look at another fix from v2.3.3 core - the php versions - and error messages.

  if (PHP_VERSION >= '5.2') {
	    date_default_timezone_set(defined('CFG_TIME_ZONE') ? CFG_TIME_ZONE : 'UTC');
  }

I think after timezone_set can call timezone_get function only. If you not defined 'CFG_TIME_ZONE' in installation step you can not run into false.