|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Mon Feb 16, 2009 5:57 pm Post subject: PHP5 Compatible use |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Feb 16, 2009 7:43 pm Post subject: |
|
|
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 |
|
Weli_07 Smarty n00b
Joined: 28 Feb 2011 Posts: 1
|
Posted: Mon Feb 28, 2011 10:31 am Post subject: |
|
|
Excellent topic.
It helped me a lot, thanks. |
|
Back to top |
|
|
|
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
|