Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

PHP5 Compatible use

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Mon Feb 16, 2009 5:57 pm    Post subject: PHP5 Compatible use Reply with quote

When compiling the templates for the first time, with E_STRICT and E_ALL error reporting enabled, I saw the following message:

Strict Standards: strftime() [function.strftime]: 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 'UTC' for '5.8/no DST' instead in D:\htdocs\admin\public_html\smarty\Smarty_Compiler.class.php on line 409

I solved it by adding the following code, before using Smarty.
Code:
if(function_exists('date_default_timezone_set'))
   date_default_timezone_set('Asia/Tokyo');


This worked, because, lower versions of PHP don't give this message, and it is guaranteed that php 5 has date_default_timezone_set function.

I do not need to call this patch in the entire application, but just for Smarty. So, will there be an option to automatically use date_default_timezone_set in the later release?
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Feb 16, 2009 7:43 pm    Post subject: Reply with quote

Actually, this holds true for any PHP code that uses date/time functions, not just Smarty. It just so happens that one of Smarty's plugins uses strftime(). This is something that needs addressing by the developer, not Smarty itself, as each developer may have their own set of circumstances for the timezone setup. As the error states "It is not safe to rely on the system's timezone settings". But, it is also not Smarty's position to decide how you want your timezone set.
Back to top
View user's profile Send private message Visit poster's website
Weli_07
Smarty n00b


Joined: 28 Feb 2011
Posts: 1

PostPosted: Mon Feb 28, 2011 10:31 am    Post subject: Reply with quote

Excellent topic.
It helped me a lot, thanks. Laughing
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP