bedita icon indicating copy to clipboard operation
bedita copied to clipboard

php >= 5.3 and date_default_timezone_set

Open xho opened this issue 8 years ago • 5 comments

With PHP version >= 5.3 there is a warning on missing timezone. Uncommenting date_default_timezone_set('CET') in core.php resolves the issue. The problem is that on certain setup you simply get a 500 server error and even initial setup does not work.

xho avatar Mar 14 '16 09:03 xho

Should it be always be uncommented? Or there should be a check which enables this settings ad hoc?

xho avatar Mar 14 '16 09:03 xho

The warning is due to the fact that PHP expects the default time zone to be set in php.ini. Once you set your server's time zone there, the warning disappears everywhere. This warning can also be suppressed using date_default_timezone_set, but AFAIK is considered "bad practice", and that function should be used to override the system value if needed, instead.

TL;DR I think it should be left commented by default, and I wouldn't consider this a bug. :) It's rather an issue with the server setup.

fquffio avatar Mar 14 '16 09:03 fquffio

Ok, this is why I put the question label. Nonetheless on some default configurations the php.ini directive is not present. Maybe it should be verified during setup.

For example: I made a test install of BEdita on an amazon ec2 machine (Amazon Linux with php-fpm56) and, since I only had a server error 500, only after a while I figured the problem.

xho avatar Mar 14 '16 10:03 xho

Uhm… Maybe we could force display of PHP errors and warnings in wizard mode? :confused: For sure, an additional check for this can be performed.

fquffio avatar Mar 14 '16 10:03 fquffio

Yes, something like. But ini_get('date.timezone') would not work?

xho avatar Mar 14 '16 10:03 xho