GetSimple Support Forum
BUG REPORT It is not safe to rely on the system's timezone settings. - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: BUG REPORT It is not safe to rely on the system's timezone settings. (/showthread.php?tid=11879)



It is not safe to rely on the system's timezone settings. - chefbyte - 2019-10-15

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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /plugins/news_manager/inc/functions.php on line 18

Showing loads of error messages on my site please anyone?


Code:
/*******************************************************
* @function nm_get_posts
* @param $all if true, include private and future posts
* @return array with posts
*/
function nm_get_posts($all=false) {
 $now = time();
 $posts = array();
 $data = @getXML(NMPOSTCACHE);
 foreach ($data->item as $item) {
   if ($all || $item->private != 'Y' && strtotime($item->date) < $now)   <~~~Line 18
     $posts[] = $item;
 }
 return $posts;
}



RE: It is not safe to rely on the system's timezone settings. - chefbyte - 2019-10-15

site address is www.peteberry.co.uk


RE: It is not safe to rely on the system's timezone settings. - datiswous - 2019-10-15

It's plugin related right? (News Manager)
Maybe post it in it's specific forum.


RE: It is not safe to rely on the system's timezone settings. - Felix - 2019-10-15

I had this error message thrown from my local development server
The solution was to open php.ini and search for "data.timezone"
Uncomment data.timezone
and example set it to this: data.timezone = "Europe/London"

change "Europe/London" to your local time zone

=========================================================

Go to your hosting CPanel and see if you can edit php.ini
and check if data.timezone is configured

If your CPanel does not give you the option to edit php.ini
then create your own php.ini and upload it to the root
of your website.

See if that helps


RE: It is not safe to rely on the system's timezone settings. - Bigin - 2019-10-15

If your application runs on an Apache and you are not able to access the php.ini file, you can also use date_default_timezone_set('Europe/London') php function. It sets the default timezone used by all date functions in your script.

Note, it has to be called before calling the date/time functions.


RE: It is not safe to rely on the system's timezone settings. - Carlos - 2019-10-15

@chefbyte, did you select a local timezone in your GS settings?


RE: It is not safe to rely on the system's timezone settings. - chefbyte - 2019-10-16

(2019-10-15, 23:08:27)Carlos Wrote: @chefbyte, did you select a local timezone in your GS settings?

I did indeed set it as it was the first place I looked to see if it was correct Smile


RE: It is not safe to rely on the system's timezone settings. - Carlos - 2019-10-16

Try setting the timezone in gsconfig.php, like:
Code:
define('GSTIMEZONE', 'Europe/London');
or
Code:
define('GSTIMEZONE', 'UTC');

I think that you have to set Local timezone to --None-- in GS settings, so that this works.


RE: It is not safe to rely on the system's timezone settings. - Carlos - 2019-10-16

Anyway, I suspect you have an old version of the News Manager plugin. (Not sure if it's related to your issue, but I suggest you upgrade just in case.)