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

Tobias Liebig mail_typo3 at etobi.de
Fri Apr 30 15:28:08 CEST 2010


Hej,

i've tested and reviewed your patch. The soultions looks fine so far.
But i still get a warning, when date_default_timezone_get is called.

Warning: date_default_timezone_get() 
[function.date-default-timezone-get]: It is not safe to rely

i added two "@" to supress these warnings. I think it's ok here, because 
it's part of checking the (missing) settings and avoid other warnings later.


+1 by reading and testing.

Adjusted patch attached.

regards
    tobias



Am 05.11.09 18:06, schrieb Ernesto Baschny [cron IT]:
> 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-v7.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100430/270485a9/attachment.txt>


More information about the TYPO3-team-core mailing list