Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-07-27 16:51:10

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Timezone code produces E_STRICT/E_WARNING

If PHP version supports Auto-DST and new TZ features, but user disables Auto-DST, all datetime functions in plugin function called via callback, TXP’s commenting system etc will produce errors. Let’s give small code example:

register_callback('timezone_test','textpattern_end');

/**
	Small testing function. Calls datetime function.
*/

function timezone_test() {
	echo
		safe_strftime('%Y');
}

Results:

Strict Standards: getdate() [function.getdate]: 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 'Europe/Helsinki' for '3.0/DST' instead in C:\xampp\htdocs\developement\rah\textpattern\lib\txplib_misc.php on line 1262

Strict Standards: mktime() [function.mktime]: 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 'Europe/Helsinki' for '3.0/DST' instead in C:\xampp\htdocs\developement\rah\textpattern\lib\txplib_misc.php on line 1263

Strict Standards: Non-static method timezone::is_dst() should not be called statically in C:\xampp\htdocs\developement\rah\textpattern\lib\txplib_misc.php on line 1265

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 'Europe/Helsinki' for '3.0/DST' instead in C:\xampp\htdocs\developement\rah\textpattern\lib\txplib_misc.php on line 1299

Following conditions must be met:

  • PHP 5.1.0+
  • Site must be in Live mode. Testing and debugging won’t return E_STRICT.
  • Auto-DST must be disabled. Will result in commenting fails too which is ‘fixed’ in SVN (supressed).

This happens on various servers when Auto-DST is disabled. There are quite many threads about the issue over the forums, and posts in plugin threads.

Current workaround:

  • Using SVN build which supresses errors.
  • Setting Auto-DST on which fixes all other errors than timezone::is_dst()’s calling.

Last edited by Gocom (2010-07-27 17:08:54)

Offline

#2 2010-08-05 15:57:11

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Timezone code produces E_STRICT/E_WARNING

What’s your suggestion to deal with this inconsitency in PHP’s error reporting besides the mentioned fix?

Offline

#3 2010-08-05 19:47:29

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Timezone code produces E_STRICT/E_WARNING

wet wrote:

What’s your suggestion to deal with this inconsitency in PHP’s error reporting besides the mentioned fix?

If you say merely suppressing the errors is a fix, then I will say that forcing Auto-DST on (when supported) is a fix, because setting it on, removes the notices, except method timezone::is_dst() should not be called statically.

Last edited by Gocom (2010-08-05 19:57:47)

Offline

Board footer

Powered by FluxBB