PHP5 warnings on core WordPress 2.8.4 (3 posts)

  1. szetlan
    Posted 6 years ago #

    Recently upgraded my system to Mac OS X 10.6, which installs PHP 5.3.0. It also happened to remove my php.ini file, which reset my customizations to error logging, and I noticed lots of error messages like the following:

    Warning: strtotime(): 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 'America/New_York' for 'EDT/-4.0/DST' instead in /Users/scott/Sites/usic.net/wp-includes/functions.php on line 35

    Yes, I can update my php.ini to include the date.timezone setting, but I strongly recommend that a call to date_default_timezone_set() be instrumented somewhere in WordPress. Given that the system asks me what time zone it's in, I'm a little surprised not to see the system then set the default time zone anywhere.

    See http://us.php.net/manual/en/function.date-default-timezone-set.php.

  2. Actually, date_default_timezone_set is used in WordPress, just not early enough to avoid those warnings.

    Your php.ini really should be updated, that's the best policy. Adding your own date_default_timezone_set() call at the top of wp-config.php will work too.

  3. Mark Barnes
    Posted 6 years ago #

    That's not quite true. date_default_timezone_set is not called unless the city is set, which it isn't on a new installation. The warnings only go away once the General options page has been saved for the first time.

    Incidentally a similar bug manifests itself with the uploads folder. That's only set correctly when you save the miscellaneous settings for the first time.

Topic Closed

This topic has been closed to new replies.

About this Topic