Page MenuHomePhabricator

Use date_default_timezone_* instead of TZ environment variable if available
Closed, ResolvedPublic


Author: nekocue

Since PHP 5.1.0, it is recommended to use date_default_timezone_set/date_default_timezone_get
functions instead of setting `TZ' environment variable to change the time zone. And the
former may enable users to change the time zone under safe-mode systems which prevent
changing environment variables.

Version: 1.9.x
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:28 PM
bzimport set Reference to bz7715.
bzimport added a subscriber: Unknown Object (MLST).

nekocue wrote:

patch to GlobalFunctions.php and Parser.php

This patch replaces putenv('TZ=foo') and getenv() with date_default_timezone_*
functions, and provides compatible functions setting/getting TZ environment
variable for PHP < 5.1.0.


alefzet wrote:

Strict standards error in Parser.php with function date()

Displayed error message:

Strict Standards: date() []: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 'Asia/Karachi' for '5.0/no DST' instead in C:\xampplite\htdocs\w\includes\Parser.php on line 2388

Lines changes from 2388 to 2396
Environment: Windows XP SP2, XAMPPlite v. 1.6.2

My guess: this is introduced in r35469

robert wrote:

Reverted in r35504. Regardless an E_STRICT level error does not constitute a major seveirty and High priority bug.

  • This bug has been marked as a duplicate of bug 2658 ***