[TYPO3-core] Alternative patch to RFC #11587: PHP Warnings concerning missing timezone settings under PHP 5.3

Ernesto Baschny [cron IT] ernst at cron-it.de
Thu Nov 5 18:06:21 CET 2009


Rupert Germann schrieb:

> thanks for improving this.
> 
> but ernestos patch does not work under PHP 5.3
> 
> date_default_timezone_get() always returns something. If timezone is not
> set in php.ini it return the value that PHP has choosen - in my case
> this was "Europe/Paris"
> 
> to get the real value ini_get() must be used.

Ok, I had misunderstood the documentation.

Now I see, in date():

"Every call to a date/time function will generate a E_NOTICE if the time
zone is not valid, and/or a E_STRICT or E_WARNING message if using the
system settings or the TZ environment variable. See also
date_default_timezone_set()"

And another place the info that it was E_STRICT until 5.2 and E_WARNING
from 5.3 on (which is probably the reason of this bug).

So PHP will still work and use the "server TZ" if no php.ini setting is
found but generate a warning, which is what we are trying to suppress.

> see attached patch where I changed this.

I think it makes no sense to set the default to "UTC", as PHP might be
using the server TZ if the date.timezone setting is not present, so we
might also do that. In your case "Europe/Paris" is a valid TZ.

See attached patch. Does it work and is understandable?

Cheers,
Ernesto
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 11587-v6.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091105/01a66168/attachment.txt>


More information about the TYPO3-team-core mailing list