Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-08-29 08:17:47

pwg
Member
From: *sunny* Melbourne, Au
Registered: 2004-02-24
Posts: 14
Website

Timestamp errors in 4.5

I am trying Txp again after several years.

Downloaded 4.5 and installed locally (Mac OSX Mountain Lion). I get errors that may or may not be due to Txp or my PHP setup. I’d appreciate your quick advice on where this might come from.

“Internal error “getdate() [function.getdate]: 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 ‘Antarctica/Macquarie’ for ‘EST/10.0/no DST’ instead”.

Many thank,

Peter


Peter Gallagher — www.petergallagher.com.au — inquit pty ltd

Offline

#2 2012-08-29 08:35:48

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

Re: Timestamp errors in 4.5

Make sure that you have date.timezone set in PHP’s configuration file (either in php.ini or per-directory user.ini).

date.timezone = "Antarctica/Macquarie"

The above should be appropriate setting for you. After you have done that, make sure you have a time zone selected in Textpattern’s Preferences panel.

The error is due to PHP configuration (or lack of), but nonetheless Textpattern’s date and time handling could take some minor improvements.

Offline

#3 2012-08-29 09:17:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Timestamp errors in 4.5

Gocom wrote:

Textpattern’s date and time handling could take some minor improvements.

OT: is there an issue/patch raised for this somewhere? If not, would you be able to submit one please?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2012-08-29 10:07:56

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Timestamp errors in 4.5

I stumbled over this as well a little while ago.

Offline

#5 2012-08-29 10:19:44

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Timestamp errors in 4.5

… and this may or may not be connected/relevant/important

Offline

#6 2012-08-29 22:50:01

pwg
Member
From: *sunny* Melbourne, Au
Registered: 2004-02-24
Posts: 14
Website

Re: Timestamp errors in 4.5

Gocom wrote:

Make sure that you have date.timezone set in PHP’s configuration file (either in php.ini or per-directory user.ini).

Hi Gocom… That worked, thanks. Turned out I didn’t have a php.ini file in my /etc directory (Mountain Lion!…. GRRRR!).

Created one from the php.ini.default and inserted date.timezone = Australia/Melbourne.

Many thanks,

Peter


Peter Gallagher — www.petergallagher.com.au — inquit pty ltd

Offline

#7 2012-08-30 01:28:39

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

Re: Timestamp errors in 4.5

Bloke wrote:

OT: is there an issue/patch raised for this somewhere? If not, would you be able to submit one please?

I’m not aware of one on the issue tracker, but all of these issues have been raised on this forums previously, mainly by Adi and Sam.

The main thing is, shouldn’t Textpattern actually set the timezone to what user selected instead of using just its own offset calculation? The offset calculations are fine, but the functions do report the timezone as the one used by the server, while the given time is the one from the timezone selected in the preferences. That doesn’t make sense.

Then there is that the preferences panel expects that the timezone strings present in the timezone field are supported by the server. If one is missing from the timezone table, you get nasty errors. I don’t really know why it can happen or why PHP gives out timezone codes that don’t work, but the issue is present. The fix may come down to suppressing errors in the timezone class (when using date()).

The biggest thing when it comes to dates and Textpattern, is storing which has been brought up again and again. There is some confusion between MySQL and PHP (both may not use the same time) and that the stored dates don’t specify timezone which could be used to do consistent calculations. Currently it seems that it’s expected that the offset is always correct.

Offline

#8 2012-08-30 05:32:51

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

Re: Timestamp errors in 4.5

Gocom wrote:

The main thing is, shouldn’t Textpattern actually set the timezone to what user selected instead of using just its own offset calculation?

Things are a bit more complicated. Think of a post for a future date while DST changes between the wall-clock time as the author hits the “Publish” button and the article’s “Posted” timestamp. I haven’t found a way to prevent own offset calculations to cater for that scenario.

Offline

#9 2016-01-10 19:30:00

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Timestamp errors in 4.5

Gocom wrote #264957:

Make sure that you have date.timezone set in PHP’s configuration file (either in php.ini or per-directory user.ini).

I was getting those annoying errors again locally with the 4.5.7 install and forgot why. Then remembered I’ve since updated to El Capo, so… Go to check existence of php.ini and I’m faced with all of these options:

  • php.ini-5.2-previous
  • php.ini-5.2-previous~orig
  • php.ini.default
  • php.ini.default-5.2-previous
  • php.ini.default-5.2-previous~orig

Give me a break.

Duplicated php.ini.default and dropped the “.default”… Didn’t solve it.

Opened the new php.ini and found date.timezone at lines 907–910:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =

Of course it’s commented out.

Uncommented line and added time zone from list

date.timezone = Europe/Paris

Save. Click around in admin-side… Still get the errors.

Go to Preferences and find “Automatically adjust Daylight Saving Time setting?” is set to “No”.

Switch to “Yes.” Save. Click around… No errors!

All of this in “Testing” mode, btw.

So it seem “Testing” mode will throw the errors regardless of whether php.ini exists or date.timezone is uncommented and set, but not when “Automatically adjust DST?” is “Yes”.

And though not tested, I’m guessing when mode is “Live”, it would suppress the errors too, regardless of php.ini exists or date.timezone?

In both of those modes, however, it’s recommended to have a php.ini file and date.timezone set, I presume?

Once I get it squared in the brain, it will go in Preferences docs.

Offline

Board footer

Powered by FluxBB